| 433 | } |
| 434 | |
| 435 | static void *find_field(lua_State *state, int index, const char *mode) |
| 436 | { |
| 437 | lookup_field(state, index, mode); |
| 438 | |
| 439 | // Methods |
| 440 | if (lua_isfunction(state, -1)) |
| 441 | return NULL; |
| 442 | |
| 443 | // Otherwise must be a pointer |
| 444 | if (!lua_isuserdata(state, -1)) |
| 445 | field_error(state, index, "corrupted field table", mode); |
| 446 | |
| 447 | void *p = lua_touserdata(state, -1); |
| 448 | lua_pop(state, 1); |
| 449 | |
| 450 | // NULL => metafield |
| 451 | if (!p) |
| 452 | get_metafield(state); |
| 453 | return p; |
| 454 | } |
| 455 | |
| 456 | static int cur_iter_index(lua_State *state, int len, int fidx, int first_idx = -1) |
| 457 | { |
no test coverage detected