Initial commit
This commit is contained in:
23
lua/tokyo/utils.lua
Normal file
23
lua/tokyo/utils.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local U = {}
|
||||
|
||||
function U.tprint(tbl, indent)
|
||||
if not indent then indent = 0 end
|
||||
for k, v in pairs(tbl) do
|
||||
local formatting = string.rep(" ", indent) .. k .. ": "
|
||||
if type(v) == "table" then
|
||||
print(formatting)
|
||||
U.tprint(v, indent + 1)
|
||||
elseif type(v) == 'boolean' then
|
||||
print(formatting .. tostring(v))
|
||||
else
|
||||
print(formatting .. v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function U.hex2rgb(hex)
|
||||
hex = hex:gsub("#","")
|
||||
return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6))
|
||||
end
|
||||
|
||||
return U
|
||||
Reference in New Issue
Block a user