| 83 | |
| 84 | |
| 85 | static int str_sub (lua_State *L) { |
| 86 | size_t l; |
| 87 | const char *s = luaL_checklstring(L, 1, &l); |
| 88 | size_t start = posrelatI(luaL_checkinteger(L, 2), l); |
| 89 | size_t end = getendpos(L, 3, -1, l); |
| 90 | if (start <= end) |
| 91 | lua_pushlstring(L, s + start - 1, (end - start) + 1); |
| 92 | else lua_pushliteral(L, ""); |
| 93 | return 1; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | static int str_reverse (lua_State *L) { |
nothing calls this directly
no test coverage detected