For example, can I declare a metamethod for __index which takes two arguments, then do something like myuserdata[somearg1, somearg2]? Not that I want to use it or that I have any idea of why it would be useful, I’m just wondering if in my library that deals with binding c++ to Lua I can and should enforce a right (except for __call metamethod of course) number of arguments of the function bound as metamethod.
For example, can I declare a metamethod for __index which takes two arguments, then
Share
Lua doesn’t enforce parameter counts on functions in general: http://ideone.com/kAynR
That said, the metamethods which map to syntax are bound by the syntax – for instance, Lua syntax doesn’t allow
,-separated values inside[]indexing: