diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7592fdf48..3fd58f637 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -33,8 +33,6 @@ #define NOHUD if (hud_running)\ return luaL_error(L, "HUD rendering code should not call this function!"); -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); boolean luaL_checkboolean(lua_State *L, int narg) { luaL_checktype(L, narg, LUA_TBOOLEAN); diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index ed0295ca1..c6856b426 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -28,9 +28,6 @@ return luaL_error(L, "HUD rendering code should not call this function!"); // for functions not allowed in hooks or coroutines (supercedes above) #define NOHOOK if (!lua_lumploading)\ return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); -// for functions only allowed within a level -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); static const char *cvname = NULL; diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 1ab2828bf..82843db4e 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -29,9 +29,6 @@ #include "fastcmp.h" #include "doomstat.h" -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); - enum sector_e { sector_valid = 0, sector_floorheight, diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 5ddcb0ca7..de1b854f6 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -22,9 +22,6 @@ #include "lua_libs.h" #include "lua_hud.h" // hud_running errors -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); - static const char *const array_opt[] ={"iterate",NULL}; enum mobj_e { diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index c4b092c6f..b7bdaa1be 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -22,9 +22,6 @@ #include "lua_libs.h" #include "lua_hud.h" // hud_running errors -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); - static int lib_iteratePlayers(lua_State *L) { INT32 i = -1; diff --git a/src/lua_script.h b/src/lua_script.h index b690e4fa7..fcbca2937 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -15,6 +15,7 @@ #include "m_fixed.h" #include "doomtype.h" #include "d_player.h" +#include "g_state.h" #include "blua/lua.h" #include "blua/lualib.h" @@ -97,4 +98,7 @@ void COM_Lua_f(void); // uncomment if you want seg_t/node_t in Lua // #define HAVE_LUA_SEGS +#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ +return luaL_error(L, "This can only be used in a level!"); + #endif diff --git a/src/lua_thinkerlib.c b/src/lua_thinkerlib.c index 8fa2869c8..877294898 100644 --- a/src/lua_thinkerlib.c +++ b/src/lua_thinkerlib.c @@ -16,9 +16,6 @@ #include "lua_script.h" #include "lua_libs.h" -#define INLEVEL if (gamestate != GS_LEVEL && !titlemapinaction)\ -return luaL_error(L, "This function can only be used in a level!"); - #define META_ITERATIONSTATE "iteration state" /*static const char *const iter_opt[] = {