MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / checkoption

Function checkoption

3rd/lua-5.4.3/src/loslib.c:274–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272
273
274static const char *checkoption (lua_State *L, const char *conv,
275 ptrdiff_t convlen, char *buff) {
276 const char *option = LUA_STRFTIMEOPTIONS;
277 int oplen = 1; /* length of options being checked */
278 for (; *option != '\0' && oplen <= convlen; option += oplen) {
279 if (*option == '|') /* next block? */
280 oplen++; /* will check options with next length (+1) */
281 else if (memcmp(conv, option, oplen) == 0) { /* match? */
282 memcpy(buff, conv, oplen); /* copy valid option to buffer */
283 buff[oplen] = '\0';
284 return conv + oplen; /* return next item */
285 }
286 }
287 luaL_argerror(L, 1,
288 lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv));
289 return conv; /* to avoid warnings */
290}
291
292
293static time_t l_checktime (lua_State *L, int arg) {

Callers 1

os_dateFunction · 0.85

Calls 2

luaL_argerrorFunction · 0.85
lua_pushfstringFunction · 0.85

Tested by

no test coverage detected