-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb searcher
50 lines (44 loc) · 1.11 KB
/
db searcher
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
component = require("component")
serialize = require("serialization")
readnserial = function(filename)
filer=io.open(filename,"r")
cont=filer:read("*all")
tabsi = serialize.unserialize(cont)
filer:close()
return tabsi
end
dbtable = readnserial("dblist.txt")
hashtoslot = function(hash)
local found = 0
for k,v in pairs(dbtable) do
slot = component.proxy(v).indexOf(hash)
if slot > 0 then
dbaddy = v
found = 1
break
end
end
if found == 1 then
return dbaddy, slot
else
return 0
end
end
labeltohash = function(label)
hashtable = readnserial("dbhash.txt")
print(hashtable[label][0])
if hashtable[label] == nil then
return 0
else
if #hashtable[label] == 1 then
print("single table")
return hashtable[label][1]
else
print("mult table")
return hashtable[label]
end
end
end
---print(labeltohash("Diamond"))
dbaddy,num = hashtoslot(labeltohash("Diamond"))
component.me_exportbus.setExportConfiguration(3,1,dbaddy, num)