int pmain(lua_State *L) { int status; luaL_checkversion(L); while (true) { status = luaL_loadfile(L, MAIN_SCRIPT); if (status == LUA_OK) status = lua_pcall(L, 0, LUA_MULTRET, 0); if (status == LUA_OK) break; printf("Error: %s\n", lua_tostring(L, -1)); lua_pop(L, 1); getchar(); } return 1; }