Log In  

function namer()
if e.name == 1 then print(rat,48,10)
end
end

P#97773 2021-09-25 05:40

runs fine for me, is it a runtime error on your end?
Like

type(e)~="table"

?

P#97779 2021-09-25 07:09

did you put it in an update or draw? its not a runtime error and it comes up nill

P#97786 2021-09-25 11:12 ( Edited 2021-09-25 11:17)

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).

P#97794 2021-09-25 16:42

it 100% is a runtime error; it errors when running.

P#97811 2021-09-25 23:18

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

P#97813 2021-09-25 23:38

and your sure e is in _env when you call namer?

P#97815 2021-09-25 23:51

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.

P#97819 2021-09-26 01:50

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?

P#97822 2021-09-26 02:49

because i want to be able to change it from one name to another quickly
so rat is 1 2 might be goblin

P#97826 2021-09-26 03:00 ( Edited 2021-09-26 03:01)
1

Is rat meant to be "rat" then maybe?

P#97833 2021-09-26 03:45

ill come back to this later

P#97836 2021-09-26 06:05

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].

P#97870 2021-09-27 08:45 ( Edited 2021-09-27 08:46)

i relised my mistake it was because it was not a string

P#104539 2022-01-08 09:07

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 01:05:19 | 0.008s | Q:27