MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / setfield

Function setfield

extlibs/lua/src/loslib.c:207–214  ·  view source on GitHub ↗

** About the overflow check: an overflow cannot occur when time ** is represented by a lua_Integer, because either lua_Integer is ** large enough to represent all int fields or it is not large enough ** to represent a time that cause a field to overflow. However, if ** times are represented as doubles and lua_Integer is int, then the ** time 0x1.e1853b0d184f6p+55 would cause an overflow when addi

Source from the content-addressed store, hash-verified

205** to compute the year.
206*/
207static void setfield (lua_State *L, const char *key, int value, int delta) {
208 #if (defined(LUA_NUMTIME) && LUA_MAXINTEGER <= INT_MAX)
209 if (value > LUA_MAXINTEGER - delta)
210 luaL_error(L, "field '%s' is out-of-bound", key);
211 #endif
212 lua_pushinteger(L, (lua_Integer)value + delta);
213 lua_setfield(L, -2, key);
214}
215
216
217static void setboolfield (lua_State *L, const char *key, int value) {

Callers 1

setallfieldsFunction · 0.85

Calls 3

luaL_errorFunction · 0.85
lua_pushintegerFunction · 0.85
lua_setfieldFunction · 0.85

Tested by

no test coverage detected