use table.copy instead of homemade wesh.nested_copy
parent
f272a1b210
commit
9dafbf48bf
16
init.lua
16
init.lua
|
@ -551,9 +551,9 @@ function wesh.split_boundary(boundary, axis)
|
||||||
end
|
end
|
||||||
if span > 0 then
|
if span > 0 then
|
||||||
local limit = math.ceil(span / 2)
|
local limit = math.ceil(span / 2)
|
||||||
local sub_one = wesh.nested_copy(boundary)
|
local sub_one = table.copy(boundary)
|
||||||
sub_one.max[axis] = limit
|
sub_one.max[axis] = limit
|
||||||
local sub_two = wesh.nested_copy(boundary)
|
local sub_two = table.copy(boundary)
|
||||||
sub_two.min[axis] = limit + 1
|
sub_two.min[axis] = limit + 1
|
||||||
if next_axis then
|
if next_axis then
|
||||||
wesh.merge_tables(boundaries, wesh.split_boundary(sub_one, next_axis))
|
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()
|
return text:gsub("[^%w]+", "_"):lower()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function wesh.copy_file(source, dest)
|
function wesh.copy_file(source, dest)
|
||||||
local src_file = io.open(source, "rb")
|
local src_file = io.open(source, "rb")
|
||||||
if not src_file then
|
if not src_file then
|
||||||
|
@ -765,17 +764,6 @@ function wesh.merge_tables(t1, t2)
|
||||||
end
|
end
|
||||||
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)
|
function wesh.notify(player, message)
|
||||||
local formspec = "size[10,5]textarea[1,1;8,3;notice;Notice;" .. minetest.formspec_escape(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]"
|
.. "button_exit[6,4;3,0;exit;Okay]"
|
||||||
|
|
Loading…
Reference in New Issue