lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hope this isn't too stupid of a question.... we've got three of us here with marginal Lua knowledge :)  and it's stumped all of us.

What is the canonical, or better, the most efficient way of determining the current type of a Lua  variable?

"type(myVar)" returns a string -- which is correct, but doing lots of string compares seems very inefficient (I need to argument check on some heavily used functions).

In the C api we've got lua_type() that gives an enumerated type. 

Is the only way within Lua to do string compares?  I've been all over the docs and haven't seen anything else.

(I told you it was stupid :)

thx - j