mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Add flag to disable deferral of nested properties
This commit is contained in:
parent
ccaeb030f3
commit
4c639f8388
4 changed files with 95 additions and 68 deletions
13
src/lib.luau
13
src/lib.luau
|
|
@ -75,6 +75,7 @@ local vide = {
|
|||
|
||||
-- flags
|
||||
strict = (nil :: any) :: boolean,
|
||||
defer_nested_properties = (nil :: any) :: boolean,
|
||||
|
||||
-- temporary
|
||||
apply = function(instance: Instance)
|
||||
|
|
@ -96,18 +97,18 @@ local vide = {
|
|||
|
||||
setmetatable(vide :: any, {
|
||||
__index = function(_, index: unknown): ()
|
||||
if index == "strict" then
|
||||
return flags.strict
|
||||
else
|
||||
if flags[index] == nil then
|
||||
throw(`{tostring(index)} is not a valid member of vide`)
|
||||
else
|
||||
return flags[index]
|
||||
end
|
||||
end,
|
||||
|
||||
__newindex = function(_, index: unknown, value: unknown)
|
||||
if index == "strict" then
|
||||
flags.strict = value :: boolean
|
||||
else
|
||||
if flags[index] == nil then
|
||||
throw(`{tostring(index)} is not a valid member of vide`)
|
||||
else
|
||||
flags[index] = value
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue