simplify creation functions

This commit is contained in:
OgelGames
2024-05-19 01:17:15 +10:00
parent 2be3b91f38
commit 799c4b706d
3 changed files with 34 additions and 40 deletions

View File

@ -15,10 +15,14 @@ function fakelib.is_metadata(x)
return false
end
function fakelib.create_metadata(meta)
function fakelib.create_metadata(data)
local fields = {}
if meta and fakelib.is_metadata(meta) then
fields = meta:to_table().fields
if type(data) == "table" then
for k,v in pairs(data) do
if type(k) == "string" and type(v) == "string" then
fields[k] = v
end
end
end
return secure_table({fields = fields}, fake_metadata, identifier)
end