mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-11-17 15:48:28 +01:00
Add string.split function (#500)
This commit is contained in:
parent
f98ea14023
commit
fef402e88a
@ -238,6 +238,16 @@ local function safe_string_find(...)
|
||||
return string.find(...)
|
||||
end
|
||||
|
||||
-- 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
|
||||
|
||||
local function remove_functions(x)
|
||||
local tp = type(x)
|
||||
if tp == "function" then
|
||||
@ -507,6 +517,7 @@ local function create_environment(pos, mem, event, itbl, send_warning)
|
||||
reverse = string.reverse,
|
||||
sub = string.sub,
|
||||
find = safe_string_find,
|
||||
split = safe_string_split,
|
||||
},
|
||||
math = {
|
||||
abs = math.abs,
|
||||
|
Loading…
Reference in New Issue
Block a user