Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
--- 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 function luautils.fileExist(file) return fs.open(file, "r") end function luautils.getCurrentScriptName(includeExtension) local name = debug.getinfo(1, "S").short_src if includeExtension then name = name:match("(.+)%..+$") end return name end
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)