Check the return value from lua_open()

It always fails when running under valgrind because valgrind does not
implement mmap functionality that LuaJIT requires.
This commit is contained in:
Thomas Goyne 2014-07-10 15:47:40 -07:00
parent bffbae0ed9
commit 4dc38447dc
2 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,12 @@ int main(int argc, char **argv) {
// Init lua state
lua_State *L = lua_open();
agi::lua::preload_modules(L);
if (!L) {
fprintf(stderr, "Failed to create Lua state\n");
return 1;
}
preload_modules(L);
Install(L, {"include"});
// Build arg table for scripts

View File

@ -401,6 +401,7 @@ namespace {
// create lua environment
L = lua_open();
if (!L) return;
bool loaded = false;
BOOST_SCOPE_EXIT_ALL(&) { if (!loaded) Destroy(); };