Output:
18:49:43.694 - Workspace.TModule:4: attempt to perform arithmetic on local 'a' (a table value) 18:49:43.694 - Stack Begin 18:49:43.694 - Script 'Workspace.TModule', Line 4 - method GeneratePlate
Source Code:
--continued, but this is the only part that errors. function tm.GeneratePlate(a,b,c,type,x,y,z) if a%2~=0 then a=a-1 end --continued, but this is the only part that errors.
Running Code:
tm:GeneratePlate(10,math.random(50,200),10,math.random(0,17),math.random(-200,200),0,math.random(-200,200))
I don't understand what's wrong with anything. All of this should work, I looked over it again and again.
As it says, it believes a
is a "table value," rather than an integer.
It is correct! Be careful about using methods (:
).
Use tm.GeneratePlate
instead of tm:GeneratePlate
.
Methods are sugar. They automatically add the object you are calling them on as the first argument:
tm:GeneratePlate( ... )
de-sugars to tm.GeneratePlate(tm, ... )
which makes the first argument (a
) actually tm
-- "a table value", rather than the first argument you typed.
Locked by adark, 2eggnog, and TofuBytes
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?