Thread Tools Display Modes
05-04-10, 07:48 PM   #1
Stijn
A Murloc Raider
Join Date: Oct 2008
Posts: 7
argcheck()

After hurting my head on luaL_argcheck in the Lua manual, I found that this function is declared at the top of the file

Just one thing I don't understand, why do you start counting arguments at 2 ?
For example, if you do
Code:
oUF:RegisterStyle("abc","def")
you get
Bad argument #3 to 'RegisterStyle' (function, table expected, got string
while "def" is argument #2
  Reply With Quote
05-04-10, 11:39 PM   #2
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Stijn View Post
After hurting my head on luaL_argcheck in the Lua manual, I found that this function is declared at the top of the file

Just one thing I don't understand, why do you start counting arguments at 2 ?
For example, if you do
Code:
oUF:RegisterStyle("abc","def")
you get

while "def" is argument #2
Code:
oUF:RegisterStyle("abc","def")
Is syntactic sugar[1] for:
Code:
oUF.RegisterStyle(oUF, "abc", "def")
In stock Lua we can actually get information about which type you called through the debug library, but we don't have access to that in WoW.

[1] Slightly incorrect to actually call it syntactic sugar, as Lua actually has a optimization for that path.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
05-04-10, 11:47 PM   #3
Stijn
A Murloc Raider
Join Date: Oct 2008
Posts: 7
Ok, now it makes sense. Thank you
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » argcheck()


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off