lua-users home
lua-l archive

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


I guess there will be no difference, because "global" funtions are not
exactly global, they are just regular functions stored in global
enviroment table, and also accessed throuth it.

There will be a performance penalty if the global table has a __index metamethod, and this is the common behaviour for compat-5.1, where each lua script has it's own environment with {__index=_G} metatable.

I think the more efficient solution is to store the function in a table and then lua_rawget it. I think a numeric index is faster than a string one because Lua won't need to hash it before the lookup (I repeat: I think, so I have no sure about it. Correct me if I'm wrong).

--rb