OK, it looks like LuaJIT is the problem. Using standard Lua works fine. I have 5.3.0 installed.
I reduced the offending code to the following standalone program which works under Lua but crashes under LuaJIT, so I don't think the problem is related to Solarus.
With a few small tweaks I managed to build the quest editor, and tested it by loading ZSDX (screenshot attached). The main issue is that the math functions such as floor() are not in the std:: namespace.
One small problem is that when running a quest from the editor, the game window does not appear to receive keyboard events. For example, ZSDX gets stuck at the "press the space bar" stage. It works fine when using solarus_run.
I reduced the offending code to the following standalone program which works under Lua but crashes under LuaJIT, so I don't think the problem is related to Solarus.
Code Select
#include <lua.h>
#include <lauxlib.h>
int import_from_file(char * file_name) {
printf("import_from_file %s\n", file_name);
lua_State* l = luaL_newstate();
if (luaL_loadfile(l, file_name) != 0) {
fprintf(stderr, "Failed to load file %s: %s\n", file_name, lua_tostring(l, -1));
lua_pop(l, 1);
return 0;
}
printf("result: %s\n", lua_tostring(l,0));
lua_close(l);
return 1;
}
int main(int argc, char ** argv) {
import_from_file("/Users/stewart/local/git/solarus-quest-editor/build/test/data/quest.dat");
}
With a few small tweaks I managed to build the quest editor, and tested it by loading ZSDX (screenshot attached). The main issue is that the math functions such as floor() are not in the std:: namespace.
One small problem is that when running a quest from the editor, the game window does not appear to receive keyboard events. For example, ZSDX gets stuck at the "press the space bar" stage. It works fine when using solarus_run.