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

Function iter_aux

third-party/lua-5.5.0/src/lutf8lib.c:228–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226
227
228static int iter_aux (lua_State *L, int strict) {
229 size_t len;
230 const char *s = luaL_checklstring(L, 1, &len);
231 lua_Unsigned n = (lua_Unsigned)lua_tointeger(L, 2);
232 if (n < len) {
233 while (iscontp(s + n)) n++; /* go to next character */
234 }
235 if (n >= len) /* (also handles original 'n' being negative) */
236 return 0; /* no more codepoints */
237 else {
238 l_uint32 code;
239 const char *next = utf8_decode(s + n, &code, strict);
240 if (next == NULL || iscontp(next))
241 return luaL_error(L, MSGInvalid);
242 lua_pushinteger(L, l_castU2S(n + 1));
243 lua_pushinteger(L, l_castU2S(code));
244 return 2;
245 }
246}
247
248
249static int iter_auxstrict (lua_State *L) {

Callers 2

iter_auxstrictFunction · 0.70
iter_auxlaxFunction · 0.70

Calls 5

luaL_checklstringFunction · 0.70
utf8_decodeFunction · 0.70
luaL_errorFunction · 0.70
lua_pushintegerFunction · 0.70
lua_tointegerFunction · 0.50

Tested by

no test coverage detected