New compat.h module implements luaL_setfuncs.
Makes initialization code simpler everywhere.
This commit is contained in:
parent
321c0c9b1f
commit
e75444ccd1
20 changed files with 164 additions and 173 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "inet.h"
|
||||
|
||||
|
@ -41,11 +42,7 @@ int inet_open(lua_State *L)
|
|||
{
|
||||
lua_pushstring(L, "dns");
|
||||
lua_newtable(L);
|
||||
#if LUA_VERSION_NUM > 501 && !defined(LUA_COMPAT_MODULE)
|
||||
luaL_setfuncs(L, func, 0);
|
||||
#else
|
||||
luaL_openlib(L, NULL, func, 0);
|
||||
#endif
|
||||
lua_settable(L, -3);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue