| 98 | |
| 99 | |
| 100 | static 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 | |
| 112 | static int str_reverse (lua_State *L) { |
nothing calls this directly
no test coverage detected