| 4802 | } |
| 4803 | |
| 4804 | DISABLE_WARNING_UNREACHABLE_CODE |
| 4805 | |
| 4806 | /* convert map-relative coordinate to absolute. |
| 4807 | local ax,ay = nh.abscoord(rx, ry); |
| 4808 | local pt = nh.abscoord({ x = 10, y = 5 }); |
| 4809 | */ |
| 4810 | int |
| 4811 | nhl_abs_coord(lua_State *L) |
| 4812 | { |
| 4813 | int argc = lua_gettop(L); |
| 4814 | coordxy x = -1, y = -1; |
| 4815 | |
| 4816 | if (argc == 2) { |
| 4817 | x = (coordxy) lua_tointeger(L, 1); |
| 4818 | y = (coordxy) lua_tointeger(L, 2); |
| 4819 | cvt_to_abscoord(&x, &y); |
| 4820 | lua_pushinteger(L, x); |
| 4821 | lua_pushinteger(L, y); |
| 4822 | return 2; |
| 4823 | } else if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) { |
| 4824 | x = (coordxy) get_table_int(L, "x"); |
| 4825 | y = (coordxy) get_table_int(L, "y"); |
| 4826 | cvt_to_abscoord(&x, &y); |
| 4827 | lua_newtable(L); |
| 4828 | nhl_add_table_entry_int(L, "x", x); |
| 4829 | nhl_add_table_entry_int(L, "y", y); |
| 4830 | return 1; |
| 4831 | } else { |
| 4832 | nhl_error(L, "nhl_abs_coord: Wrong args"); |
| 4833 | /*NOTREACHED*/ |
| 4834 | return 0; |
| 4835 | } |
| 4836 | } |
| 4837 | |
| 4838 | /* feature("fountain", x, y); */ |
| 4839 | /* feature("fountain", {x,y}); */ |
nothing calls this directly
no test coverage detected