Programming In Lua Comments |
|
2.4 - Why is concatenation (..
) right associative? See AssociativityOfConcatenation.
2.5 - Concerning "An associative array is an array that can be indexed not only with numbers, but also with strings or any other value in the language, except Nil
" and also 27.3 - p.252 - "The registry is a regular Lua table. As such, you can index it with any Lua value but nil." NaN
can fail too--see LuaList:2008-03/msg00603.html .
2.5 - What is the computational complexity of #
and table.maxn
? --DavidManura
#
is O(log Na)
, where Na
is the size of the array part of the table. table.maxn
is O(N)
where N
is the total allocated size of the table, because every key has to be examined. --RiciLake
27.3 - p.254 - spelling: register -> registry (in "favor the environment over the register")
28.2 - The luaL_newmetatable/luaL_getmetatable/luaL_checkudata
functions use a C string as a key into the registry. I'd prefer simply using a lightuserdata for this or storing the metatable as an upvalue (more efficient and less error prone). I also avoid passing a name to luaL_register
because there's an unnecessary risk of name conflicts, and this sets a global variable much like the module
function criticized in LuaModuleFunctionCritiqued. --DavidManura
(none currently)
(none currently)