lua-users home
lua-l archive

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

1) Why is only one function declaration syntax supported in tables?  This

Sounds like a bug to me.

2) In C it possible to determine the number of elements in a table without
iterating it.

I don't know.

3) My C function is called from LUA and passed a table.  How can I find the
name of the table?  lua_tostring returns nil.  In LUA I have
"library.RegisterClass(MyClass)", in C I need the string "MyClass".

This is basically the same problem as "How do I get the name of a
function?".  Search the list archives (and I think the manual sections on
functions and debugging) for coverage in depth on this.

Your problem here is that there is no single right answer to the question of
"what is this table named?".  Tables are assigned into variables by
reference so...

A = {1, 2, 3}
B = A

results in a single table value being referenced by both "A", and "B".  (the
same holds for passing tables as function parameters)

However, Lua tables can use ANY Lua value as a key, so you can do the

MyLookupTable = { [A] = "MyClass" }
C = A


---- outputs ----

4) I could not find any forums discussing the API side of LUA (all were pure
scripting discussion).  If there is a better place to pose rudimentary
questions of the sort I've been asking then please let me know.  You guys
seem to be discussing some pretty hard core stuff and I hate to waste your

Nope, this is the place for anything... newbie, advanced, submitting
suggestions for improvements, etc.

However, also take a look at the Wiki.