mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:39:02 -06:00
Merge branch 'master' of https://github.com/MillaBasset/cambridge
This commit is contained in:
commit
6b595d2146
16
funcs.lua
16
funcs.lua
@ -97,6 +97,22 @@ function table.contains(table, element)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.keys(table)
|
||||||
|
local target = {}
|
||||||
|
for key in pairs(table) do
|
||||||
|
target[#target+1] = key
|
||||||
|
end
|
||||||
|
return target
|
||||||
|
end
|
||||||
|
|
||||||
|
function table.numkeys(table)
|
||||||
|
local count = 0
|
||||||
|
for k in pairs(table) do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
function clamp(x, min, max)
|
function clamp(x, min, max)
|
||||||
if max < min then
|
if max < min then
|
||||||
min, max = max, min
|
min, max = max, min
|
||||||
|
Loading…
Reference in New Issue
Block a user