mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 15:23:47 +01:00
fix get_facts
This commit is contained in:
parent
8b6730afe6
commit
d90a6d6dda
15
init.lua
15
init.lua
@ -29,9 +29,22 @@ local function save_factions()
|
|||||||
storage:set_string("facts", minetest.serialize(facts))
|
storage:set_string("facts", minetest.serialize(facts))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function table_copy(data)
|
||||||
|
local copy = {}
|
||||||
|
if type(data) == "table" then
|
||||||
|
for k,v in pairs(data) do
|
||||||
|
copy[k]=table_copy(v)
|
||||||
|
end
|
||||||
|
return copy
|
||||||
|
else
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Data manipulation
|
-- Data manipulation
|
||||||
function factions.get_facts()
|
function factions.get_facts()
|
||||||
return {table.unpack(facts)}
|
return table_copy(facts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.player_is_in_faction(fname, player_name)
|
function factions.player_is_in_faction(fname, player_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user