Posted 06 June 2014 - 12:23 PM
Im making a program to monitor my energy storage and i am having a problem that i cannot figure out. I am trying to set a variable in a table but it tells me "Index expected, got string" and i dont know why. I have used the very same method of setting variables in tables many times before and never gotten this error.I have 2 computer in this setup. The purpous of the program i am having trouble whit is to handle commands sent to it and relay them to the main computer as the main computer is bussy getting information about the storage units.
It gives me the error at line 51, 53, 55, 57 or 59 depending on what message i pass to it through the chat_command feature in openPeripheral.
This is the effected part of the code.
Whole program: http://pastebin.com/wbWceT56
It gives me the error at line 51, 53, 55, 57 or 59 depending on what message i pass to it through the chat_command feature in openPeripheral.
This is the effected part of the code.
elseif e == "chat_command" then
print (var1)
if var2 == playername then
if var1 == "off" then
setts["state"] = false
elseif var1 == "on" then
setts["state"] = true
elseif var1 == "eu" then
setts["display"] = "eu"
elseif var1 == "mj" then
setts["display"] = "mj"
elseif var1 == "back" then
setts["display"] = "all"
end
end
The setts table is called at the top of the programWhole program: http://pastebin.com/wbWceT56