From 8cba9ed83fe4d02b76e224862ca85ce014592b80 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 8 Dec 2014 11:21:29 +0800 Subject: use luaL_requiref for lua 5.2 --- lua/lua-plugin-init.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua') diff --git a/lua/lua-plugin-init.c b/lua/lua-plugin-init.c index 8e95286..dfc1665 100644 --- a/lua/lua-plugin-init.c +++ b/lua/lua-plugin-init.c @@ -49,9 +49,13 @@ static const luaL_Reg lualibs[] = { void lua_plugin_openlibs (lua_State *L) { const luaL_Reg *lib = lualibs; for (; lib->func; lib++) { +#if LUA_VERSION_NUM >= 502 + luaL_requiref(L, lib->name, lib->func, TRUE); +#else lua_pushcfunction(L, lib->func); lua_pushstring(L, lib->name); lua_call(L, 1, 0); +#endif } } -- cgit