lua-users home
lua-l archive

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


>Thanks! I've followed the example in lua.c, and it seems to work. I have just
>two questions. Firstly, what is lua_pushliteral? I've done this using
>lua_getglobal. Any reason not to?

lua.c takes special care with errors and so at that point uses lua_rawget
instead of lua_gettable, which is what lua_getglobal does. lua_pushliteral is
a simple macro that avoids the call to strlen in lua_pushstring when you use
literal strings. You can use lua_getglobal.

>And secondly, to do this I've had to use the
>dblib, but I'm not sure I want to give my users access to it. Is there any way
>to prevent them from using it? Would something like just setting the global
>'debug' to nil work?

Yes, you can set 'debug' to nil after loading dblib. But perhaps you can just
copy errorfb from ldblib.c into your code and not load dblib at all.
--lhf