-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCode3.lua
More file actions
48 lines (29 loc) · 926 Bytes
/
TestCode3.lua
File metadata and controls
48 lines (29 loc) · 926 Bytes
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
# for test
local cjson = require "cjson"
for i=2,4,1 do
print(i)
end
tt = {2,7,9}
for i,v in ipairs(tt) do
print(i,v)
end
function htgetn(hashtable)
local n = 0
for _,v in pairs(hashtable) do
n = n + 1
end
return n
end
print(htgetn(tt))
print("------")
SegmentFlagDict = {1,1,1,1,6,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0}
table.remove(SegmentFlagDict,4)
print(SegmentFlagDict[5])
for i,v in ipairs(SegmentFlagDict) do
if tonumber(v) == 0 then
table.remove(SegmentFlagDict,i)
print(cjson.encode(SegmentFlagDict))
end
end
print(cjson.encode(SegmentFlagDict))
print(os.date())