function namer()
if e.name == 1 then print(rat,48,10)
end
end
runs fine for me, is it a runtime error on your end?
Like
type(e)~="table" |
?
did you put it in an update or draw? its not a runtime error and it comes up nill
Where is 'e' meant to come from? The function does not take parameters which is strange (working only with global variables makes code harder to understand and to change).
there is a enemy table
e={}
e.h=10
e.mh=10
e.d=0
e.a=2
e.name=1
e.dead=false
e.enemies=5
e.wave=1
We don’t have much info to understand the situation here.
Can you share more code and, most importantly the exact error message? Or even upload the cart.
Is this rat variable defined beforehand? Should you be passing e as a parameter to this function perhaps? What exactly is the error message? Why not have e.name be the enemy name instead of an integer?
because i want to be able to change it from one name to another quickly
so rat is 1 2 might be goblin
From what I understand, I think you may have forgotten to define variable, rat. If a variable hasn't been set to a value, your Namer function will print [nil].
[Please log in to post a comment]