Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ver()
- return 0.35
- end
- function explode(str, sep)
- local function trim(str)
- return (string.gsub(str, "^%s*(.-)%s*$", "%1"))
- end
- local pos, t = 1, {}
- if #sep == 0 or #str == 0 then return end
- for s, e in function() return string.find(str, sep, pos) end do
- table.insert(t, trim(string.sub(str, pos, s-1)))
- pos = e+1
- end
- table.insert(t, trim(string.sub(str, pos)))
- return t
- end
- function isNumeric(inpNum)
- if tonumber(inpNum) ~= nil then
- return true
- else
- return false
- end
- end
- function tableExists(inp_table, inp_string)
- tableExistsPos = {}
- tableExistsReturns = false
- for i=1, table.getn(inp_table) do
- if inp_table[i] == inp_string then
- tableExistsReturns = true
- table.insert(tableExistsPos, i)
- end
- end
- return tableExistsReturns, tableExistsPos
- end
- function tableLongest(_tTable)
- local c = 0
- local pos = nil
- for i=1, #_tTable do
- if string.len(_tTable[i]) > c then
- c = string.len(_tTable[i])
- pos = i
- end
- end
- return c, pos
- end
- function makeLn(_iLen, _sSymbol)
- local base = ""
- _iLen = _iLen or 1
- _sSymbol = _sSymbol or "-"
- for i=1, _iLen do
- base = base.._sSymbol
- end
- return base
- end
- function checkAPI(inp_api, inp_ver)
- if type(inp_api) == "table" then
- if type(inp_api.ver) == "function" then
- if inp_api.ver() >= inp_ver then
- return true
- else
- print("This program cannot run - too old API")
- end
- else
- print("This program cannot run - missing API")
- end
- else
- print("This program cannot run - incompatible API")
- end
- end
- function cls()
- term.clear()
- term.setCursorPos(1, 1)
- return true
- end
- function bitLine(_tLine)
- tmp = {}
- for i=1, math.max(unpack(_tLine)) do
- tmp[i] = 0
- if util.tableExists(_tLine, i) then
- tmp[i] = 1
- end
- end
- return tmp
- end
- function isAdvancedComputer()
- if term.isColor and term.isColor() then
- return true
- else
- return false
- end
- end
- function osVersion()
- return tonumber(string.sub(os.version(), 9))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement