Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Simple utils to assist Lua programming v1.0
- luautils = {}
- -- Print text whit custom color
- function luautils.printColored(text, color)
- local ogColor = term.getTextColor()
- if color then
- term.setTextColor(color)
- end
- print(text)
- term.setTextColor(ogColor)
- end
- --- Return true if the table contains the specified key
- function luautils.containsKey(tbl, key)
- for k, _ in pairs(tbl) do
- if k == key then
- return true
- end
- end
- return false
- end
- --- Return true if the table contains the specified value
- function luautils.containsValue(tbl, value)
- for _, v in pairs(tbl) do
- if v == value then
- return true
- end
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment