MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / str_sub

Function str_sub

extlibs/lua/src/lstrlib.c:100–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100static int str_sub (lua_State *L) {
101 size_t l;
102 const char *s = luaL_checklstring(L, 1, &l);
103 size_t start = posrelatI(luaL_checkinteger(L, 2), l);
104 size_t end = getendpos(L, 3, -1, l);
105 if (start <= end)
106 lua_pushlstring(L, s + start - 1, (end - start) + 1);
107 else lua_pushliteral(L, "");
108 return 1;
109}
110
111
112static int str_reverse (lua_State *L) {

Callers

nothing calls this directly

Calls 5

luaL_checklstringFunction · 0.85
posrelatIFunction · 0.85
luaL_checkintegerFunction · 0.85
getendposFunction · 0.85
lua_pushlstringFunction · 0.85

Tested by

no test coverage detected