mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-09-27 23:00:29 +02:00
Use safe_string_spit function
This commit is contained in:
parent
f1ff092770
commit
0c9fe6a9aa
|
@ -231,6 +231,16 @@ local function safe_string_find(...)
|
||||||
return string.find(...)
|
return string.find(...)
|
||||||
end
|
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 function remove_functions(x)
|
||||||
local tp = type(x)
|
local tp = type(x)
|
||||||
if tp == "function" then
|
if tp == "function" then
|
||||||
|
@ -463,7 +473,7 @@ local function create_environment(pos, mem, event, itbl, send_warning)
|
||||||
reverse = string.reverse,
|
reverse = string.reverse,
|
||||||
sub = string.sub,
|
sub = string.sub,
|
||||||
find = safe_string_find,
|
find = safe_string_find,
|
||||||
split = string.split,
|
split = safe_string_split,
|
||||||
},
|
},
|
||||||
math = {
|
math = {
|
||||||
abs = math.abs,
|
abs = math.abs,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user