Get x and y values from a table (which the caller has already checked for * the existence of), handling both a table with x= and y= specified and a * table with coord= specified. * Returns absolute rather than map-relative coordinates; the caller of this * function must decide if it wants to interpret the coordinates as * map-relative and adjust accordingly. */
| 3185 | * function must decide if it wants to interpret the coordinates as |
| 3186 | * map-relative and adjust accordingly. */ |
| 3187 | staticfn void |
| 3188 | get_table_xy_or_coord( |
| 3189 | lua_State *L, |
| 3190 | lua_Integer *x, |
| 3191 | lua_Integer *y) |
| 3192 | { |
| 3193 | lua_Integer mx = get_table_int_opt(L, "x", -1); |
| 3194 | lua_Integer my = get_table_int_opt(L, "y", -1); |
| 3195 | |
| 3196 | if (mx == -1 && my == -1) { |
| 3197 | lua_getfield(L, 1, "coord"); |
| 3198 | (void) get_coord(L, -1, &mx, &my); |
| 3199 | lua_pop(L, 1); |
| 3200 | } |
| 3201 | |
| 3202 | *x = mx; |
| 3203 | *y = my; |
| 3204 | } |
| 3205 | |
| 3206 | /* monster(); */ |
| 3207 | /* monster("wood nymph"); */ |
no test coverage detected