MCPcopy Create free account
hub / github.com/DFHack/dfhack / math_max

Function math_max

depends/lua/src/lmathlib.c:229–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229static 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

Callers

nothing calls this directly

Calls 3

lua_gettopFunction · 0.85
lua_compareFunction · 0.85
lua_pushvalueFunction · 0.85

Tested by

no test coverage detected