| 14600 | |
| 14601 | |
| 14602 | static int maxn (lua_State *L) { |
| 14603 | lua_Number max = 0; |
| 14604 | luaL_checktype(L, 1, LUA_TTABLE); |
| 14605 | lua_pushnil(L); /* first key */ |
| 14606 | while (lua_next(L, 1)) { |
| 14607 | lua_pop(L, 1); /* remove value */ |
| 14608 | if (lua_type(L, -1) == LUA_TNUMBER) { |
| 14609 | lua_Number v = lua_tonumber(L, -1); |
| 14610 | if (v > max) max = v; |
| 14611 | } |
| 14612 | } |
| 14613 | lua_pushnumber(L, max); |
| 14614 | return 1; |
| 14615 | } |
| 14616 | |
| 14617 | |
| 14618 | static int getn (lua_State *L) { |
nothing calls this directly
no test coverage detected