Get the topmost object on the map at x,y */ local o = obj.at(x, y); */
| 386 | /* Get the topmost object on the map at x,y */ |
| 387 | /* local o = obj.at(x, y); */ |
| 388 | staticfn int |
| 389 | l_obj_at(lua_State *L) |
| 390 | { |
| 391 | int argc = lua_gettop(L); |
| 392 | |
| 393 | if (argc == 2) { |
| 394 | coordxy x, y; |
| 395 | |
| 396 | x = (coordxy) luaL_checkinteger(L, 1); |
| 397 | y = (coordxy) luaL_checkinteger(L, 2); |
| 398 | cvt_to_abscoord(&x, &y); |
| 399 | |
| 400 | lua_pop(L, 2); |
| 401 | (void) l_obj_push(L, svl.level.objects[x][y]); |
| 402 | return 1; |
| 403 | } else |
| 404 | nhl_error(L, "l_obj_at: Wrong args"); |
| 405 | /*NOTREACHED*/ |
| 406 | return 0; |
| 407 | } |
| 408 | |
| 409 | /* Place an object on the map at (x,y). |
| 410 | local o = obj.new("rock"); |
nothing calls this directly
no test coverage detected