MCPcopy Create free account
hub / github.com/defold/defold / timeout_meth_settimeout

Function timeout_meth_settimeout

engine/script/src/luasocket/timeout.c:161–177  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Sets timeout values for IO operations * Lua Input: base, time [, mode] * time: time out value in seconds * mode: "b" for block timeout, "t" for total timeout. (default: b) \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

159* mode: "b" for block timeout, "t" for total timeout. (default: b)
160\*-------------------------------------------------------------------------*/
161int timeout_meth_settimeout(lua_State *L, p_timeout tm) {
162 double t = luaL_optnumber(L, 2, -1);
163 const char *mode = luaL_optstring(L, 3, "b");
164 switch (*mode) {
165 case 'b':
166 tm->block = t;
167 break;
168 case 'r': case 't':
169 tm->total = t;
170 break;
171 default:
172 luaL_argcheck(L, 0, 3, "invalid timeout mode");
173 break;
174 }
175 lua_pushnumber(L, 1);
176 return 1;
177}
178
179/*=========================================================================*\
180* Test support functions

Callers 4

meth_settimeoutFunction · 0.85
meth_settimeoutFunction · 0.85
meth_settimeoutFunction · 0.85
meth_settimeoutFunction · 0.85

Calls 2

luaL_optnumberFunction · 0.85
lua_pushnumberFunction · 0.85

Tested by

no test coverage detected