diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 149c9d503..7a94dd559 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -2691,20 +2691,19 @@ int CLuaInstance::checkVersion(lua_State *L) lua_pushnil(L); return 1; } - int major=0, minor=0, ret=1; + int major=0, minor=0; major = luaL_checkint(L, 2); minor = luaL_checkint(L, 3); if ((major > LUA_API_VERSION_MAJOR) || ((major == LUA_API_VERSION_MAJOR) && (minor > LUA_API_VERSION_MINOR))) { - ret = 0; char msg[1024]; snprintf(msg, sizeof(msg)-1, "%s (v%d.%d)\n%s v%d.%d", g_Locale->getText(LOCALE_LUA_VERSIONSCHECK1), LUA_API_VERSION_MAJOR, LUA_API_VERSION_MINOR, g_Locale->getText(LOCALE_LUA_VERSIONSCHECK2), major, minor); - DisplayErrorMessage(msg, "Lua Script Error:"); + luaL_error(L, msg); } - lua_pushinteger(L, ret); + lua_pushinteger(L, 1); /* for backward compatibility */ return 1; } diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 1dc3d4f1f..848f59588 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -34,7 +34,7 @@ extern "C" { #include #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 2 +#define LUA_API_VERSION_MINOR 4 /* this is stored as userdata in the lua_State */ struct CLuaData