MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / checkoption

Function checkoption

third-party/lua-5.3.5/src/loslib.c:260–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258
259
260static const char *checkoption (lua_State *L, const char *conv,
261 ptrdiff_t convlen, char *buff) {
262 const char *option = LUA_STRFTIMEOPTIONS;
263 int oplen = 1; /* length of options being checked */
264 for (; *option != '\0' && oplen <= convlen; option += oplen) {
265 if (*option == '|') /* next block? */
266 oplen++; /* will check options with next length (+1) */
267 else if (memcmp(conv, option, oplen) == 0) { /* match? */
268 memcpy(buff, conv, oplen); /* copy valid option to buffer */
269 buff[oplen] = '\0';
270 return conv + oplen; /* return next item */
271 }
272 }
273 luaL_argerror(L, 1,
274 lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv));
275 return conv; /* to avoid warnings */
276}
277
278
279/* maximum size for an individual 'strftime' item */

Callers 1

os_dateFunction · 0.70

Calls 2

luaL_argerrorFunction · 0.70
lua_pushfstringFunction · 0.70

Tested by

no test coverage detected