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 5539618a43..4f328dd84a 100644
--- a/apps/plugins/lua/rocklua.c
+++ b/apps/plugins/lua/rocklua.c
@@ -26,7 +26,8 @@
26#include "rocklib.h" 26#include "rocklib.h"
27#include "luadir.h" 27#include "luadir.h"
28 28
29 29#undef LUA_BITLIBNAME
30#define LUA_BITLIBNAME "bit"
30 31
31static const luaL_Reg lualibs[] = { 32static const luaL_Reg lualibs[] = {
32 {"", luaopen_base}, 33 {"", luaopen_base},
@@ -34,7 +35,7 @@ static const luaL_Reg lualibs[] = {
34 {LUA_STRLIBNAME, luaopen_string}, 35 {LUA_STRLIBNAME, luaopen_string},
35 {LUA_OSLIBNAME, luaopen_os}, 36 {LUA_OSLIBNAME, luaopen_os},
36 {LUA_ROCKLIBNAME, luaopen_rock}, 37 {LUA_ROCKLIBNAME, luaopen_rock},
37 {LUA_BITLIBNAME, luaopen_bit}, 38 {LUA_BITLIBNAME, luaopen_bit32},
38 {LUA_IOLIBNAME, luaopen_io}, 39 {LUA_IOLIBNAME, luaopen_io},
39 {LUA_LOADLIBNAME, luaopen_package}, 40 {LUA_LOADLIBNAME, luaopen_package},
40 {LUA_MATHLIBNAME, luaopen_math}, 41 {LUA_MATHLIBNAME, luaopen_math},
@@ -43,11 +44,10 @@ static const luaL_Reg lualibs[] = {
43}; 44};
44 45
45static void rocklua_openlibs(lua_State *L) { 46static void rocklua_openlibs(lua_State *L) {
46 const luaL_Reg *lib = lualibs; 47 const luaL_Reg *lib;
47 for (; lib->func; lib++) { 48 for (lib = lualibs; lib->func; lib++) {
48 lua_pushcfunction(L, lib->func); 49 luaL_requiref(L, lib->name, lib->func, 1);
49 lua_pushstring(L, lib->name); 50 lua_pop(L, 1); /* remove lib */
50 lua_call(L, 1, 0);
51 } 51 }
52} 52}
53 53