Use table.copy instead of each separate function

This commit is contained in:
Lejo1 2020-03-30 14:22:57 +02:00
parent 077cdaa2a4
commit a19ef422ea
No known key found for this signature in database
GPG Key ID: 7249ED75EF7EBABC
1 changed files with 4 additions and 48 deletions

View File

@ -475,52 +475,8 @@ local function create_environment(pos, mem, event, itbl, send_warning)
find = safe_string_find,
split = safe_string_split,
},
math = {
abs = math.abs,
acos = math.acos,
asin = math.asin,
atan = math.atan,
atan2 = math.atan2,
ceil = math.ceil,
cos = math.cos,
cosh = math.cosh,
deg = math.deg,
exp = math.exp,
factorial = math.factorial,
floor = math.floor,
fmod = math.fmod,
frexp = math.frexp,
huge = math.huge,
hypot = math.hypot,
ldexp = math.ldexp,
log = math.log,
log10 = math.log10,
max = math.max,
min = math.min,
modf = math.modf,
pi = math.pi,
pow = math.pow,
rad = math.rad,
random = math.random,
sin = math.sin,
sing = math.sign,
sinh = math.sinh,
sqrt = math.sqrt,
tan = math.tan,
tanh = math.tanh,
},
table = {
concat = table.concat,
copy = table.copy,
indexof = table.indexof,
insert = table.insert,
insert_all = table.insert_all,
key_value_swap = table.key_value_swap,
maxn = table.maxn,
remove = table.remove,
shuffle = table.shuffle,
sort = table.sort,
},
math = table.copy(math),
table = table.copy(table),
os = {
clock = os.clock,
difftime = os.difftime,
@ -530,7 +486,7 @@ local function create_environment(pos, mem, event, itbl, send_warning)
dump2 = dump2,
dump = dump,
minetest = {
wrap_text = minetest.wrap_text,
--wrap_text = minetest.wrap_text,
pos_to_string = minetest.pos_to_string,
string_to_pos = minetest.string_to_pos,
string_to_area = minetest.string_to_area,
@ -544,7 +500,7 @@ local function create_environment(pos, mem, event, itbl, send_warning)
encode_base64 = minetest.encode_base64,
decode_base64 = minetest.decode_base64,
},
vector = vector,
vector = table.copy(vector),
}
env._G = env