From db26fa29533ca55606f79892a420d6c031f60547 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Tue, 3 Feb 2015 23:03:26 +0000 Subject: Don't use luaconf.h defines, they're not stable, also switch away from lua_cpcall --- src/wrapper.c | 11 +++++++---- 1 file 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; -- cgit v1.2.1