Some improvements and fixes for raylua.dll/raylua.so.

This commit is contained in:
TSnake41 2020-08-19 16:58:45 +02:00
parent 60c982e77b
commit 44a4b94d97
5 changed files with 13 additions and 6 deletions

View File

@ -49,7 +49,7 @@ libraylua.a: src/raylua.o
$(AR) rcu $@ $^ $(AR) rcu $@ $^
raylua.dll: src/raylua.o raylua.dll: src/raylua.o
$(CC) -shared -fPIE -o $@ $^ $(LDFLAGS) $(CC) -shared -fPIE -o $@ $^ $(LDFLAGS) -llua5.1
raylua.so: src/raylua.o raylua.so: src/raylua.o
$(CC) -shared -fPIE -o $@ $^ $(LDFLAGS) $(CC) -shared -fPIE -o $@ $^ $(LDFLAGS)

View File

@ -24,7 +24,7 @@ end
local ffi = require "ffi" local ffi = require "ffi"
local C = ffi.C local C = ffi.C
rl = {} local rl = {}
setmetatable(rl, rl) setmetatable(rl, rl)
-- structs definition -- structs definition
@ -894,3 +894,5 @@ end
rl.__newindex = function () rl.__newindex = function ()
error "rl table is readonly" error "rl table is readonly"
end end
_G.rl = rl

View File

@ -39,7 +39,8 @@
extern const char *raylua_boot_str; extern const char *raylua_boot_str;
void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles, bool repl) void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
bool repl)
{ {
lua_newtable(L); lua_newtable(L);
@ -72,5 +73,8 @@ void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
int luaopen_raylua(lua_State *L) int luaopen_raylua(lua_State *L)
{ {
raylua_boot(L, NULL, NULL, false); raylua_boot(L, NULL, NULL, false);
return 0;
lua_getglobal(L, "rl");
lua_getglobal(L, "raylua");
return 2;
} }

View File

@ -20,7 +20,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <lua.h> #include <lua.h>
void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles, bool repl); void raylua_boot(lua_State *L, lua_CFunction loadfile, lua_CFunction listfiles,
bool repl);
/* raylua_boot alias to allow direct loading */ /* raylua_boot alias to allow direct loading */
int luaopen_raylua(lua_State *L); int luaopen_raylua(lua_State *L);

View File

@ -73,7 +73,7 @@ if raylua.loadfile then
end end
end end
if arg[1] then if arg and arg[1] then
dofile(arg[1]) dofile(arg[1])
return return
end end