use table.copy instead of homemade wesh.nested_copy

master
entuland 2018-06-06 13:11:15 +02:00
parent f272a1b210
commit 9dafbf48bf
1 changed files with 2 additions and 14 deletions

View File

@ -551,9 +551,9 @@ function wesh.split_boundary(boundary, axis)
end
if span > 0 then
local limit = math.ceil(span / 2)
local sub_one = wesh.nested_copy(boundary)
local sub_one = table.copy(boundary)
sub_one.max[axis] = limit
local sub_two = wesh.nested_copy(boundary)
local sub_two = table.copy(boundary)
sub_two.min[axis] = limit + 1
if next_axis then
wesh.merge_tables(boundaries, wesh.split_boundary(sub_one, next_axis))
@ -741,7 +741,6 @@ function wesh.check_plain(text)
return text:gsub("[^%w]+", "_"):lower()
end
function wesh.copy_file(source, dest)
local src_file = io.open(source, "rb")
if not src_file then
@ -765,17 +764,6 @@ function wesh.merge_tables(t1, t2)
end
end
function wesh.nested_copy(something)
local result = {}
for key, value in pairs(something) do
if type(value) == 'table' then
value = wesh.nested_copy(value)
end
result[key] = value
end
return result
end
function wesh.notify(player, message)
local formspec = "size[10,5]textarea[1,1;8,3;notice;Notice;" .. minetest.formspec_escape(message) .. "]"
.. "button_exit[6,4;3,0;exit;Okay]"