init
This commit is contained in:
commit
12ffbdc45d
76 changed files with 79368 additions and 0 deletions
25
computer/13/stringshit.lua
Normal file
25
computer/13/stringshit.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
function splitString(source, sep)
|
||||
sep = sep or " "
|
||||
elements = {}
|
||||
for str in string.gmatch(source, "([^"..sep.."]+)") do
|
||||
table.insert(elements, str)
|
||||
end
|
||||
return elements
|
||||
end
|
||||
|
||||
function stripModname(name)
|
||||
parts = splitString(name, ":")
|
||||
if #parts ~= 2 then
|
||||
printError("modname split failed")
|
||||
printError(name)
|
||||
end
|
||||
return parts[2]
|
||||
end
|
||||
|
||||
function len(table)
|
||||
l = 0
|
||||
for _, _ in pairs(table) do
|
||||
l = l + 1
|
||||
end
|
||||
return l
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue