| 213 | |
| 214 | |
| 215 | static int math_min (lua_State *L) { |
| 216 | int n = lua_gettop(L); /* number of arguments */ |
| 217 | int imin = 1; /* index of current minimum value */ |
| 218 | int i; |
| 219 | luaL_argcheck(L, n >= 1, 1, "value expected"); |
| 220 | for (i = 2; i <= n; i++) { |
| 221 | if (lua_compare(L, i, imin, LUA_OPLT)) |
| 222 | imin = i; |
| 223 | } |
| 224 | lua_pushvalue(L, imin); |
| 225 | return 1; |
| 226 | } |
| 227 | |
| 228 | |
| 229 | static int math_max (lua_State *L) { |
nothing calls this directly
no test coverage detected