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

Function getformat

third-party/lua-5.4.6/src/lstrlib.c:1245–1257  ·  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

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

Callers 1

str_formatFunction · 0.70

Calls 1

luaL_errorFunction · 0.70

Tested by

no test coverage detected