MCPcopy Create free account
hub / github.com/DFHack/dfhack / posrelat

Function posrelat

depends/lua/src/lstrlib.c:63–67  ·  view source on GitHub ↗

translate a relative string position: negative means back from end */

Source from the content-addressed store, hash-verified

61
62/* translate a relative string position: negative means back from end */
63static lua_Integer posrelat (lua_Integer pos, size_t len) {
64 if (pos >= 0) return pos;
65 else if (0u - (size_t)pos > len) return 0;
66 else return (lua_Integer)len + pos + 1;
67}
68
69
70static int str_sub (lua_State *L) {

Callers 4

str_subFunction · 0.85
str_byteFunction · 0.85
str_find_auxFunction · 0.85
str_unpackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected