Page 1 of 1

A Vague Question...?

Posted: Wed Mar 25, 2015 2:45 am
by dizzykiwi3
So I went ahead and made the mistake of implementing a big feature with multiple components without testing and building slowly. So now I'm stuck bug fixing this kind of rickety thing.

My current issue that's kind of abstract, that I'm hoping someone has encountered before, or can interpret what I fail to see is this error:

attempt to perform arithmetic on local 'parametername' (a table value)

What's supposed to be happening is that I'm passing a value of a table (e.g. tab.x) into a function, which I know is perfectly fine to do, so does anyone know exactly what that error means in layman's terms? Am I accidentally passing a table and performing arithmetic on it or is there some specific lua issue I'm missing?

Re: A Vague Question...?

Posted: Wed Mar 25, 2015 3:40 am
by Kingdaro
That's exactly what's happening. It's trying to do math with a table (e.g. tableValue + 5), but, for obvious reasons, cannot. The error specifies that it's a local variable, so it's either an argument or defined locally within the function itself.

Re: A Vague Question...?

Posted: Wed Mar 25, 2015 4:13 am
by dizzykiwi3
So how can I get around this? What exactly is the difference between a table value and the value itself?

Re: A Vague Question...?

Posted: Wed Mar 25, 2015 4:54 am
by dizzykiwi3
Am I misunderstanding what a table value is? Is a table value this:
> print(t)
table: 0035AE18
or the value of a key within a table?

Re: A Vague Question...?

Posted: Wed Mar 25, 2015 4:58 am
by dizzykiwi3
God dammit I was passing a table, right at the very top of the chain, god dammit xD thanks for help clarifying it