summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2015-02-03 23:03:26 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2015-02-03 23:03:26 +0000
commitdb26fa29533ca55606f79892a420d6c031f60547 (patch)
treeb9fc211b461b4f640c832b8a2a455e3e3e7310c5
parent56dde6201bc77f17dafdea7dfad047f51d2242b4 (diff)
downloadsupple-db26fa29533ca55606f79892a420d6c031f60547.tar.gz
Don't use luaconf.h defines, they're not stable, also switch away from lua_cpcall
-rw-r--r--src/wrapper.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
index d4f1412..3d11e01 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -54,11 +54,11 @@ main(int argc, char **argv)
/* Perform pre-lua-interpreter initialisation */
#ifndef TESTING_SUPPLE
- unsetenv(LUA_PATH);
- unsetenv(LUA_CPATH);
+ unsetenv("LUA_PATH");
+ unsetenv("LUA_CPATH");
unsetenv("SUPPLE_MKDTEMP");
#endif
- unsetenv(LUA_INIT);
+ unsetenv("LUA_INIT");
L = luaL_newstate();
if (L == NULL) {
@@ -67,7 +67,10 @@ main(int argc, char **argv)
parg.retcode = 0;
- success = lua_cpcall(L, &protected_main, &parg);
+ lua_pushcclosure(L, &protected_main, 0);
+ lua_pushlightuserdata(L, &parg);
+
+ success = lua_pcall(L, -1, 0, 0);
if (success != 0) {
size_t l;