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

Function str_sub

third-party/lua-5.2.4/src/lstrlib.c:53–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51
52
53static int str_sub (lua_State *L) {
54 size_t l;
55 const char *s = luaL_checklstring(L, 1, &l);
56 size_t start = posrelat(luaL_checkinteger(L, 2), l);
57 size_t end = posrelat(luaL_optinteger(L, 3, -1), l);
58 if (start < 1) start = 1;
59 if (end > l) end = l;
60 if (start <= end)
61 lua_pushlstring(L, s + start - 1, end - start + 1);
62 else lua_pushliteral(L, "");
63 return 1;
64}
65
66
67static int str_reverse (lua_State *L) {

Callers

nothing calls this directly

Calls 5

luaL_checklstringFunction · 0.70
posrelatFunction · 0.70
luaL_checkintegerFunction · 0.70
luaL_optintegerFunction · 0.70
lua_pushlstringFunction · 0.70

Tested by

no test coverage detected