* Strip the word "function" from INLEVEL error messages, since they're now shared between access and function cases.

* Move it into lua_script.h, so it's available to everything that needs it.
This commit is contained in:
toaster 2019-07-30 17:57:57 +01:00
parent 69e573517f
commit 7bff305672
7 changed files with 4 additions and 17 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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,

View file

@ -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 {

View file

@ -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;

View file

@ -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

View file

@ -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[] = {