lua-users home
lua-l archive

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

in all of projects where i am using C API of Lua, i am using following macros for convenience:

#define lua_setglobal_integer(L,n,v) (lua_pushinteger(L, v), lua_setglobal(L, n)) #define lua_setglobal_nil(L,n) (lua_pushnil(L), lua_setglobal(L, n)) #define lua_setglobal_boolean(L,n,v) (lua_pushboolean(L, v), lua_setglobal(L, n)) #define lua_setglobal_number(L,n,v) (lua_pushnumber(L, v), lua_setglobal(L, n)) #define lua_setglobal_string(L,n,v) (lua_pushstring(L, v), lua_setglobal(L, n)) #define lua_setglobal_lstring(L,n,v,l) (lua_pushlstring(L, v, l), lua_setglobal(L, n))

I think it would really be worth adding similar stuff to lua.h.
Perhaps creating lua_extra.h if there are reasons for not adding such thing to main header file.

What do you think?

S pozdravem
Best regards
     Tomáš Mudruňka