- new debug system

This commit is contained in:
2022-10-28 13:49:08 +02:00
parent a029771b07
commit 1a732d7c71
4 changed files with 96 additions and 168 deletions

View File

@@ -914,14 +914,14 @@ void lua_init(char* filenames) {
int size;
char* buffer = file_getfilebuffer(file_start, size);
if (luaL_loadbuffer(L, buffer, size, file_start)) {
debug("error loading game");
debug("LOADING ERROR:");
debug(lua_tostring(L, -1));
lua_pop(L,1);
return;
}
free(buffer);
if (lua_pcall(L,0, LUA_MULTRET, 0)) {
debug("runtime error");
debug("RUNTIME ERROR:");
debug(lua_tostring(L, -1));
lua_pop(L,1);
return;
@@ -945,7 +945,7 @@ void lua_call_init() {
if (!init_exists) return;
lua_getglobal(L, "_init");
if (lua_pcall(L, 0, 0, 0)) {
debug("runtime error");
debug("RUNTIME ERROR:");
debug(lua_tostring(L, -1));
lua_pop(L,1);
is_playing = false;
@@ -956,7 +956,7 @@ void lua_call_update() {
if (!update_exists) return;
lua_getglobal(L, "_update");
if (lua_pcall(L, 0, 0, 0)) {
debug("runtime error");
debug("RUNTIME ERROR:");
debug(lua_tostring(L, -1));
lua_pop(L,1);
is_playing = false;