Skip to content

Commit bacbd30

Browse files
committed
Solar array registration, assert node def changes
1 parent 58ae854 commit bacbd30

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

technic/spec/api_spec.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ describe("Technic API", function()
6868
end,
6969
}
7070
-- Make sure that original definition will not be changed during registration
71-
setmetatable(data, { __newindex = function() error("Attempt to modify original definition") end })
71+
setmetatable(data, {
72+
__newindex = function(self, key, value)
73+
assert(self ~= data, "Attempt to modify original definition")
74+
rawset(self, key, value)
75+
end
76+
})
7277
technic.register_solar_array("my_mod:my_solar_array", data)
7378

7479
-- Verify node registration

0 commit comments

Comments
 (0)