I have the following string to split into a table using lua: (the data is aligned with each other. I did not find out how to write format it like that on this site)
IP: 192.168.128.12
MAC: AF:3G:9F:c9:32:2E
Expires: Fri Aug 13 20:04:53 2010
Time Left: 11040 seconds
the result should be put into a table like this:
t = {"IP" : "192.168.128.12", "MAC" : "AF:3G:9F:c9:32:2E", "Expires" : "Fri Aug 13 20:04:53 2010", "Time Left" : "11040 seconds"}
I tried with:
for k,v in string.gmath(data, "([%w]+):([%w%p%s]+\n") do t[k] = v end
That was my best attempt. I have been sitting with this for quite some time now, but it just never becomes right. If there is anyone who can help me I will be very appreciative.
Thanks