Re: Method(a nil value) Error
I'm not sure you need any help with this, but just in case... Any function declared like this:
Code:
function MoveLeftRight(self, dist, emergency)
...
end
will be a global function (accessible to all scripts in the game) and will of probably overwrite any function with the same name declared somewhere else. That is why I prefer to put the declaration in the Create-function, like this:
Code:
function Create(self)
function self:MoveLeftRight(dist, emergency)
...
end
end
Note the position of the 'self'.
You probably already know about the on-line version of the first edition of the book
Programing in Lua and the
Reference Manual, but I can also recommend buying a physical copy of the second edition of PIL. Because it is a really good read.