Lua: Pass more data to room contents function

This commit is contained in:
Pasi Kallinen
2022-01-23 13:27:00 +02:00
parent 7b87f7b495
commit a6816824c7
4 changed files with 65 additions and 12 deletions

View File

@@ -24,7 +24,6 @@ static int nhl_doturn(lua_State *);
static int nhl_debug_flags(lua_State *);
static int nhl_test(lua_State *);
static int nhl_getmap(lua_State *);
static void nhl_add_table_entry_bool(lua_State *, const char *, boolean);
static char splev_typ2chr(schar);
static int nhl_gettrap(lua_State *);
static int nhl_deltrap(lua_State *);
@@ -225,6 +224,19 @@ nhl_add_table_entry_bool(lua_State *L, const char *name, boolean value)
lua_rawset(L, -3);
}
void
nhl_add_table_entry_region(lua_State *L, const char *name,
xchar x1, xchar y1, xchar x2, xchar y2)
{
lua_pushstring(L, name);
lua_newtable(L);
nhl_add_table_entry_int(L, "x1", x1);
nhl_add_table_entry_int(L, "y1", y1);
nhl_add_table_entry_int(L, "x2", x2);
nhl_add_table_entry_int(L, "y2", y2);
lua_rawset(L, -3);
}
/* converting from special level "map character" to levl location type
and back. order here is important. */
const struct {