add config/user-props.toml combined object
This commit is contained in:
parent
b3ac1bd8f4
commit
1cd890ff88
1
res/content/base/config/user-props.toml
Normal file
1
res/content/base/config/user-props.toml
Normal file
@ -0,0 +1 @@
|
|||||||
|
"base:durability" = {}
|
||||||
@ -1,4 +1,19 @@
|
|||||||
function make_read_only(t)
|
local user_props = file.read_combined_object("config/user-props.toml")
|
||||||
|
local names = {}
|
||||||
|
for name, _ in pairs(user_props) do
|
||||||
|
table.insert(names, name)
|
||||||
|
end
|
||||||
|
-- remove undefined properties
|
||||||
|
for id, blockprops in pairs(block.properties) do
|
||||||
|
for propname, value in pairs(blockprops) do
|
||||||
|
if propname:find(':') and not table.has(names, propname) then
|
||||||
|
print("erase property", propname)
|
||||||
|
blockprops[propname] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make_read_only(t)
|
||||||
setmetatable(t, {
|
setmetatable(t, {
|
||||||
__newindex = function()
|
__newindex = function()
|
||||||
error("table is read-only")
|
error("table is read-only")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user