This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Store addresses in database
#1
Hi guys!

I'm working on connecting LogicMachine with more devices via TCP.  I need to store IP addresses of connected devices in LogicMachine database. First time I tried to store data to Lua table, but data removes after script ends. 

The question is, how can I automatically add IP address of new connected device to Lua database?


I tried something like this with Lua tables:


Code:
t = {}

id = string.format('%s:%d', ip, port)
me  =  string.find(id, ":", 1);
ipcut = string.sub(id, 1,me-1)

count = 0
for index, value in ipairs (t) do

if value == ipcut then
count = count + 1;
alert("IP in table just exists: %d -> %s ", index, t[index]);
end


end

if count == 0 then
table.insert(t, ipcut)
end


So I need to make this thing with storage.set and insert new IP address to this DB. Can someone help me how to do it?

Thank you for every response Smile
Reply


Messages In This Thread
Store addresses in database - by hrebik - 01.06.2016, 09:15
RE: Store addresses in database - by admin - 01.06.2016, 09:20
RE: Store addresses in database - by hrebik - 01.06.2016, 09:31
RE: Store addresses in database - by admin - 01.06.2016, 09:55
RE: Store addresses in database - by hrebik - 01.06.2016, 10:05
RE: Store addresses in database - by admin - 01.06.2016, 11:22
RE: Store addresses in database - by admin - 03.08.2016, 06:24

Forum Jump: