mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Refactor
This commit is contained in:
parent
2050c2585f
commit
cc10c80a90
10 changed files with 174 additions and 220 deletions
|
|
@ -14,6 +14,7 @@ local indexes, values = require(script.maps)()
|
|||
local spring, update_springs = require(script.spring)()
|
||||
local action = require(script.action)()
|
||||
|
||||
local throw = require(script.throw)
|
||||
local flags = require(script.flags)
|
||||
|
||||
local vide = {
|
||||
|
|
@ -49,15 +50,20 @@ local vide = {
|
|||
}
|
||||
|
||||
setmetatable(vide :: any, {
|
||||
__index = function(_, index: unknown)
|
||||
error(string.format("\"%s\" is not a valid member of vide", tostring(index)), 2)
|
||||
__index = function(_, index: unknown): ()
|
||||
if index == "strict" then
|
||||
return flags.strict
|
||||
else
|
||||
throw(`{tostring(index)} is not a valid member of vide`)
|
||||
end
|
||||
end,
|
||||
|
||||
__newindex = function(_, index: unknown, value: unknown)
|
||||
if index == "strict" then
|
||||
flags.strict = if type(value) == "boolean" then value else error("strict must be a boolean", 2)
|
||||
if value ~= true then throw "strict mode can only be set to true" end
|
||||
flags.strict = true
|
||||
else
|
||||
error(string.format("\"%s\" is not a valid member of vide", tostring(index)), 2)
|
||||
throw(`{tostring(index)} is not a valid member of vide`)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue