MCPcopy Create free account
hub / github.com/NetHack/NetHack / nhl_stairways

Function nhl_stairways

src/nhlua.c:1368–1394  ·  view source on GitHub ↗

local stairs = stairways(); */

Source from the content-addressed store, hash-verified

1366
1367/* local stairs = stairways(); */
1368staticfn int
1369nhl_stairways(lua_State *L)
1370{
1371 stairway *tmp = gs.stairs;
1372 int i = 1; /* lua arrays should start at 1 */
1373
1374 lua_newtable(L);
1375
1376 while (tmp) {
1377 lua_pushinteger(L, i);
1378 lua_newtable(L);
1379
1380 nhl_add_table_entry_bool(L, "up", tmp->up);
1381 nhl_add_table_entry_bool(L, "ladder", tmp->isladder);
1382 nhl_add_table_entry_int(L, "x", tmp->sx);
1383 nhl_add_table_entry_int(L, "y", tmp->sy);
1384 nhl_add_table_entry_int(L, "dnum", tmp->tolev.dnum);
1385 nhl_add_table_entry_int(L, "dlevel", tmp->tolev.dlevel);
1386
1387 lua_settable(L, -3);
1388
1389 tmp = tmp->next;
1390 i++;
1391 }
1392
1393 return 1;
1394}
1395
1396/*
1397 test( { x = 123, y = 456 } );

Callers

nothing calls this directly

Calls 2

nhl_add_table_entry_boolFunction · 0.85
nhl_add_table_entry_intFunction · 0.85

Tested by

no test coverage detected