Skip to main content

str_sub

Function str_sub 

Source
pub fn str_sub(state: &mut LuaState) -> Result<usize, LuaError>
Expand description

string.sub(s, i [, j]) — return substring.

Borrow through to_lua_string so the full source string is not copied just to slice a (typically small) substring out of it. The GcRef keeps the bytes rooted across the check_arg_integer / opt_arg_integer calls (none of which can collect the string at arg #1).