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

Function l_selection_grow

src/nhlsel.c:630–652  ·  view source on GitHub ↗

local s = selection.grow(sel); */ local s = selection.grow(sel, "north"); */

Source from the content-addressed store, hash-verified

628/* local s = selection.grow(sel); */
629/* local s = selection.grow(sel, "north"); */
630staticfn int
631l_selection_grow(lua_State *L)
632{
633 static const char *const growdirs[] = {
634 "all", "random", "north", "west", "east", "south", NULL
635 };
636 static const int growdirs2i[] = {
637 W_ANY, W_RANDOM, W_NORTH, W_WEST, W_EAST, W_SOUTH, 0
638 };
639 struct selectionvar *sel;
640 int dir, argc = lua_gettop(L);
641
642 (void) l_selection_check(L, 1);
643 dir = growdirs2i[luaL_checkoption(L, 2, "all", growdirs)];
644
645 if (argc == 2)
646 lua_pop(L, 1); /* get rid of growdir */
647
648 (void) l_selection_clone(L);
649 sel = l_selection_check(L, 2);
650 selection_do_grow(sel, dir);
651 return 1;
652}
653
654
655/* local s = selection.filter_mapchar(sel, mapchar, lit); */

Callers

nothing calls this directly

Calls 3

l_selection_checkFunction · 0.85
l_selection_cloneFunction · 0.85
selection_do_growFunction · 0.85

Tested by

no test coverage detected