Search found 5 matches

by David10000
Fri Nov 11, 2016 2:59 pm
Forum: Support and Development
Topic: attempt to index global 'player' (a nil value)
Replies: 8
Views: 8326

Re: attempt to index global 'player' (a nil value)

Thanks for the explanation raidho, I didn't know you could do that in lua, I'm having another look at the manual (and other resources) to find out about what else I've missed. I tried putting a menu in goature's 2d platformer and it comes up with the same problem. It works on it's own but when I try...
by David10000
Thu Nov 10, 2016 5:06 pm
Forum: Support and Development
Topic: attempt to index global 'player' (a nil value)
Replies: 8
Views: 8326

Re: attempt to index global 'player' (a nil value)

For the possible reason that you don't really know what you're doing, which i'm not saying as an insult, mind you, you are defining a global variable called self in your full code, and assigning player (, another global, ) to it. The menu system also uses a global called self , so basically wheneve...
by David10000
Thu Nov 10, 2016 5:00 pm
Forum: Support and Development
Topic: attempt to index global 'player' (a nil value)
Replies: 8
Views: 8326

Re: attempt to index global 'player' (a nil value)

Self is an automatically declared local in colon notation functions, which refers to the object upon which it was called. You could otherwise use dot notation function with first argument named "self" and pass the same object into it as first argument - that's functionally identical. So s...
by David10000
Thu Nov 10, 2016 4:32 pm
Forum: Support and Development
Topic: attempt to index global 'player' (a nil value)
Replies: 8
Views: 8326

Re: attempt to index global 'player' (a nil value)

"Firstly, using globals is not a good idea anyway. Here you have it defined in one place but then it's erased elsewhere, and since it's globally available (read: could be changed from anywhere) I'd not trivial to pinpoint the problem. Which is your situation exactly. I suspect the state loader ...
by David10000
Thu Nov 10, 2016 2:44 pm
Forum: Support and Development
Topic: attempt to index global 'player' (a nil value)
Replies: 8
Views: 8326

attempt to index global 'player' (a nil value)

Hi, Brief introduction: I've been learning to code for the last few months and have done a few tutorials and made a few games, I'm at the stage where I'm trying to create my own game (barebones at the moment and using parts of tutorials, goature among others) and it was working until I put in a menu...