Skip to content

Commit

Permalink
Switch to for-loop to appease luacheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Fireboltofdeath committed Jun 4, 2024
1 parent a3d49d4 commit 6cf6dbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,13 @@ t.Vector3int16 = t.typeof("Vector3int16")
**--]]
function t.literalList(literals)
return function(value)
if table.find(literals, value) == nil then
return false, "bad type for literal list"
for _, literal in ipairs(literals) do
if literal == value then
return true
end
end

return true
return false, "bad type for literal list"
end
end

Expand Down
8 changes: 5 additions & 3 deletions lib/ts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,13 @@ t.Vector3int16 = t.typeof("Vector3int16")
**--]]
function t.literalList(literals)
return function(value)
if table.find(literals, value) == nil then
return false
for _, literal in ipairs(literals) do
if literal == value then
return true
end
end

return true
return false, "bad type for literal list"
end
end

Expand Down

0 comments on commit 6cf6dbf

Please sign in to comment.