summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklua.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklua.c')
-rw-r--r--apps/plugins/lua/rocklua.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c
index 4f328dd84a..5539618a43 100644
--- a/apps/plugins/lua/rocklua.c
+++ b/apps/plugins/lua/rocklua.c
@@ -26,8 +26,7 @@
26#include "rocklib.h" 26#include "rocklib.h"
27#include "luadir.h" 27#include "luadir.h"
28 28
29#undef LUA_BITLIBNAME 29
30#define LUA_BITLIBNAME "bit"
31 30
32static const luaL_Reg lualibs[] = { 31static const luaL_Reg lualibs[] = {
33 {"", luaopen_base}, 32 {"", luaopen_base},
@@ -35,7 +34,7 @@ static const luaL_Reg lualibs[] = {
35 {LUA_STRLIBNAME, luaopen_string}, 34 {LUA_STRLIBNAME, luaopen_string},
36 {LUA_OSLIBNAME, luaopen_os}, 35 {LUA_OSLIBNAME, luaopen_os},
37 {LUA_ROCKLIBNAME, luaopen_rock}, 36 {LUA_ROCKLIBNAME, luaopen_rock},
38 {LUA_BITLIBNAME, luaopen_bit32}, 37 {LUA_BITLIBNAME, luaopen_bit},
39 {LUA_IOLIBNAME, luaopen_io}, 38 {LUA_IOLIBNAME, luaopen_io},
40 {LUA_LOADLIBNAME, luaopen_package}, 39 {LUA_LOADLIBNAME, luaopen_package},
41 {LUA_MATHLIBNAME, luaopen_math}, 40 {LUA_MATHLIBNAME, luaopen_math},
@@ -44,10 +43,11 @@ static const luaL_Reg lualibs[] = {
44}; 43};
45 44
46static void rocklua_openlibs(lua_State *L) { 45static void rocklua_openlibs(lua_State *L) {
47 const luaL_Reg *lib; 46 const luaL_Reg *lib = lualibs;
48 for (lib = lualibs; lib->func; lib++) { 47 for (; lib->func; lib++) {
49 luaL_requiref(L, lib->name, lib->func, 1); 48 lua_pushcfunction(L, lib->func);
50 lua_pop(L, 1); /* remove lib */ 49 lua_pushstring(L, lib->name);
50 lua_call(L, 1, 0);
51 } 51 }
52} 52}
53 53