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