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

Function l_selection_getbounds

src/nhlsel.c:453–467  ·  view source on GitHub ↗

local rect = sel:bounds(); */

Source from the content-addressed store, hash-verified

451
452/* local rect = sel:bounds(); */
453staticfn int
454l_selection_getbounds(lua_State *L)
455{
456 struct selectionvar *sel = l_selection_check(L, 1);
457 NhRect rect = cg.zeroNhRect;
458
459 selection_getbounds(sel, &rect);
460 lua_settop(L, 0);
461 lua_newtable(L);
462 nhl_add_table_entry_int(L, "lx", rect.lx);
463 nhl_add_table_entry_int(L, "ly", rect.ly);
464 nhl_add_table_entry_int(L, "hx", rect.hx);
465 nhl_add_table_entry_int(L, "hy", rect.hy);
466 return 1;
467}
468
469/* internal function to get a selection and 4 integer values from lua stack.
470 removes the integers from the stack.

Callers

nothing calls this directly

Calls 3

l_selection_checkFunction · 0.85
selection_getboundsFunction · 0.85
nhl_add_table_entry_intFunction · 0.85

Tested by

no test coverage detected