bury an obj. returns true if object is gone (merged with ground), false otherwise. */ local ogone = o:bury(); */ local ogone = o:bury(5,5); */
| 600 | /* local ogone = o:bury(); */ |
| 601 | /* local ogone = o:bury(5,5); */ |
| 602 | staticfn int |
| 603 | l_obj_bury(lua_State *L) |
| 604 | { |
| 605 | int argc = lua_gettop(L); |
| 606 | boolean dealloced = FALSE; |
| 607 | struct _lua_obj *lo = l_obj_check(L, 1); |
| 608 | coordxy x = 0, y = 0; |
| 609 | |
| 610 | if (argc == 1) { |
| 611 | x = lo->obj->ox; |
| 612 | y = lo->obj->oy; |
| 613 | } else if (argc == 3) { |
| 614 | x = (coordxy) lua_tointeger(L, 2); |
| 615 | y = (coordxy) lua_tointeger(L, 3); |
| 616 | cvt_to_abscoord(&x, &y); |
| 617 | } else |
| 618 | nhl_error(L, "l_obj_bury: Wrong args"); |
| 619 | |
| 620 | if (lobj_is_ok(lo) && isok(x, y)) { |
| 621 | lo->obj->ox = x; |
| 622 | lo->obj->oy = y; |
| 623 | (void) bury_an_obj(lo->obj, &dealloced); |
| 624 | } |
| 625 | lua_pushboolean(L, dealloced); |
| 626 | return 1; |
| 627 | } |
| 628 | |
| 629 | static const struct luaL_Reg l_obj_methods[] = { |
| 630 | { "new", l_obj_new_readobjnam }, |
nothing calls this directly
no test coverage detected