My understanding is string comparisons are
quick in Lua (just a pointer comparison), because of the way strings are
stored.
From:
lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On
Behalf Of jason bright
Sent: 25 October 2006 07:38
To: lua@bazar2.conectiva.com.br
Subject: canonical way to type a
variable?
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