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

Function getformat

third-party/lua-5.5.0/src/lstrlib.c:1249–1261  ·  view source on GitHub ↗

** Get a conversion specification and copy it to 'form'. ** Return the address of its last character. */

Source from the content-addressed store, hash-verified

1247** Return the address of its last character.
1248*/
1249static const char *getformat (lua_State *L, const char *strfrmt,
1250 char *form) {
1251 /* spans flags, width, and precision ('0' is included as a flag) */
1252 size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789.");
1253 len++; /* adds following character (should be the specifier) */
1254 /* still needs space for '%', '\0', plus a length modifier */
1255 if (len >= MAX_FORMAT - 10)
1256 luaL_error(L, "invalid format (too long)");
1257 *(form++) = '%';
1258 memcpy(form, strfrmt, len * sizeof(char));
1259 *(form + len) = '\0';
1260 return strfrmt + len - 1;
1261}
1262
1263
1264/*

Callers 1

str_formatFunction · 0.70

Calls 1

luaL_errorFunction · 0.70

Tested by

no test coverage detected