[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: modules and nil function parameters
- From: Etan Reisner <deryni@...>
- Date: Thu, 11 Feb 2010 01:47:02 -0500
On Wed, Feb 10, 2010 at 10:31:02PM -0800, Joe Andresen wrote:
<snip>
> MainState.addCamera(T)
Try 'MainState:addCamera(T)'.
<snip>
> local M = {}
> M = _G.Class()
> GameState = M
This creates and immediately throws away a table, is that the intention?
<snip>
> function M:addCamera(camera) --this is nil.. what the heck?
> self.Cameras[camera.getID()] = camera
> end
This creates a function which expects two arguments, self and camera. Your
call only passes one. Check "self" you'll see it is your camera.
> thanks for any help!
> -Joe
-Etan