| 223 | |
| 224 | |
| 225 | static int math_max(lua_State *L) { |
| 226 | int n = lua_gettop(L); /* number of arguments */ |
| 227 | int imax = 1; /* index of current maximum value */ |
| 228 | int i; |
| 229 | luaL_argcheck(L, n >= 1, 1, "value expected"); |
| 230 | for (i = 2; i <= n; i++) { |
| 231 | if (lua_compare(L, imax, i, LUA_OPLT)) |
| 232 | imax = i; |
| 233 | } |
| 234 | lua_pushvalue(L, imax); |
| 235 | return 1; |
| 236 | } |
| 237 | |
| 238 | /* |
| 239 | ** This function uses 'double' (instead of 'lua_Number') to ensure that |
nothing calls this directly
no test coverage detected