-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathObjects.lua
More file actions
60 lines (56 loc) · 1.14 KB
/
Copy pathObjects.lua
File metadata and controls
60 lines (56 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function table.HasValue(table, value, index)
index = index or nil
if index then
for _, v in pairs(table) do
if v[index] == value then
return true
end
end
return false
else
for _, v in pairs(table) do
if v == value then
return true
end
end
return false
end
end
function string.strsplit (inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
function string.split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
if not unpack then
unpack = table.unpack
end
function fwrap (f,co)
local obj = {}
local started
function obj:read ()
if not started then
f:read_async(co)
started = true
end
return yield()
end
function obj:write (s)
return f:write(s)
end
return obj
end