This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Xemiru's profile picture

[Error] attempt to perform arithmetic add

Started by Xemiru, 22 November 2012 - 02:37 PM
Xemiru #1
Posted 22 November 2012 - 03:37 PM
svr:150: attempt to perform arithmetic__add on table and string
--Line 150
	 sendMessage(ssender, v + ", ", true)
--The function
local function sendMessage(target, message, noprint)
if connected[target].name ~= nil then
  if noprint == nil or noprint == true then
   rednet.send(connected[target].id, "{msg-write} {"..message.."}")
  else
   rednet.send(connected[target].id, "{msg-print} {"..message.."}")
  end
end
end

I have no idea what this means.
Notes:
- Table connected was initialized.
- The value of [target] is initialized before this as a table.
OmegaVest #2
Posted 22 November 2012 - 03:42 PM
Is v a table? If so, then it cannot be arithmetically added like that. You will need to serialize. textutils.serialize(table) I think. Also, concatenate, not add. .. instead of + .
Xemiru #3
Posted 22 November 2012 - 09:02 PM
I just realized how stupid I was at that moment.
First time I've ever confused Java with LUA in strings.