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

Function addquoted

third-party/lua-5.3.5/src/lstrlib.c:908–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

906
907
908static void addquoted (luaL_Buffer *b, const char *s, size_t len) {
909 luaL_addchar(b, '"');
910 while (len--) {
911 if (*s == '"' || *s == '\\' || *s == '\n') {
912 luaL_addchar(b, '\\');
913 luaL_addchar(b, *s);
914 }
915 else if (iscntrl(uchar(*s))) {
916 char buff[10];
917 if (!isdigit(uchar(*(s+1))))
918 l_sprintf(buff, sizeof(buff), "\\%d", (int)uchar(*s));
919 else
920 l_sprintf(buff, sizeof(buff), "\\%03d", (int)uchar(*s));
921 luaL_addstring(b, buff);
922 }
923 else
924 luaL_addchar(b, *s);
925 s++;
926 }
927 luaL_addchar(b, '"');
928}
929
930
931/*

Callers 1

addliteralFunction · 0.70

Calls 1

luaL_addstringFunction · 0.70

Tested by

no test coverage detected