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

Function l_selection_numpoints

src/nhlsel.c:202–220  ·  view source on GitHub ↗

local numpoints = selection.numpoints(sel); */

Source from the content-addressed store, hash-verified

200
201/* local numpoints = selection.numpoints(sel); */
202staticfn int
203l_selection_numpoints(lua_State *L)
204{
205 struct selectionvar *sel = l_selection_check(L, 1);
206 coordxy x, y;
207 int ret = 0;
208 NhRect rect = cg.zeroNhRect;
209
210 selection_getbounds(sel, &rect);
211
212 for (x = rect.lx; x <= rect.hx; x++)
213 for (y = rect.ly; y <= rect.hy; y++)
214 if (selection_getpoint(x, y, sel))
215 ret++;
216
217 lua_settop(L, 0);
218 lua_pushinteger(L, ret);
219 return 1;
220}
221
222/* local value = selection.get(sel, x, y); */
223staticfn int

Callers

nothing calls this directly

Calls 3

l_selection_checkFunction · 0.85
selection_getboundsFunction · 0.85
selection_getpointFunction · 0.85

Tested by

no test coverage detected