summaryrefslogtreecommitdiffstats
path: root/src/lua.c
diff options
context:
space:
mode:
authorroman65536 <roman65536@yahoo.com>2017-03-16 10:27:18 +0100
committerroman65536 <roman65536@yahoo.com>2017-03-16 10:27:18 +0100
commit75ab57d1fe52c56ab7df8ada9393a9dcc3f975c2 (patch)
treebe2f40be52e7007a6216cdc281ac49ddd6f653cd /src/lua.c
parentc2cd0390e12193fb34b334cde22a4336d1ca4c6c (diff)
Fixed segv @load due to not founding the init.lua file
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lua.c b/src/lua.c
index d706caf..507928e 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -267,10 +267,14 @@ void doLuainit() {
luaL_register(L, "sc", sclib);
+
if (luaL_loadfile(L, "init.lua")) /* Load but don't run the Lua script */
- bail(L, "luaL_loadfile() failed"); /* Error out if file can't be read */
+ {
+ fprintf(stderr, "\nWarning :\n Couldn't load init.lua: %s\n\n", lua_tostring(L,-1));
+ return;
+ }
if (lua_pcall(L, 0, 0, 0)) /* PRIMING RUN. FORGET THIS AND YOU'RE TOAST */
- bail(L, "lua_pcall() failed"); /* Error out if Lua file has an error */
+ fprintf(stderr, "\nFATAL ERROR:\n Couldn't initialized Lua: %s\n\n", lua_tostring(L,-1));
return;
}