local value = selection.get(sel, x, y); */
| 221 | |
| 222 | /* local value = selection.get(sel, x, y); */ |
| 223 | staticfn int |
| 224 | l_selection_getpoint(lua_State *L) |
| 225 | { |
| 226 | struct selectionvar *sel = l_selection_check(L, 1); |
| 227 | coordxy x, y; |
| 228 | lua_Integer ix, iy; |
| 229 | int val; |
| 230 | long crd; |
| 231 | |
| 232 | lua_remove(L, 1); /* sel */ |
| 233 | if (!nhl_get_xy_params(L, &ix, &iy)) { |
| 234 | nhl_error(L, "l_selection_getpoint: Incorrect params"); |
| 235 | /*NOTREACHED*/ |
| 236 | return 0; |
| 237 | } |
| 238 | x = (coordxy) ix; |
| 239 | y = (coordxy) iy; |
| 240 | |
| 241 | if (x == -1 && y == -1) |
| 242 | crd = SP_COORD_PACK_RANDOM(0); |
| 243 | else |
| 244 | crd = SP_COORD_PACK(x,y); |
| 245 | get_location_coord(&x, &y, ANY_LOC, |
| 246 | gc.coder ? gc.coder->croom : NULL, crd); |
| 247 | |
| 248 | val = selection_getpoint(x, y, sel); |
| 249 | lua_settop(L, 0); |
| 250 | lua_pushnumber(L, val); |
| 251 | return 1; |
| 252 | } |
| 253 | |
| 254 | RESTORE_WARNING_UNREACHABLE_CODE |
| 255 |
nothing calls this directly
no test coverage detected