-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add string.split function #500
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, why not?
Just one side note: I’m pretty unsure about this cause I don’t know why we need a secure find function |
Right. mesecons/mesecons_luacontroller/init.lua Lines 223 to 228 in f1ff092
|
Just do the same as for -- do not allow pattern matching in string.split (see string.find for details)
local function safe_string_split(...)
if select(5, ...) then
debug.sethook() -- Clear hook
error("string.split: 'sep_is_pattern' (fifth parameter) may not be used in a Luacontroller")
end
return string.split(...)
end I wonder what other helper functions it might be worth adding to the luacontroller. |
Thanks, did that! |
Included in #507 |
Adds the default minetest string.split function.
I know it's just one helper function but it were also asked in #470 and should be pretty safe.
A player could anyway add it to his controller:
We could also set the max_splits to a specific value to be 100 % sure.