require "Core.Camera.FreeCamera"
require "Core.GameState"
MainState = Core.GameState.GameState()
local T = Core.Camera.FreeCamera.FreeCamera(0,0,-35)
MainState.addCamera(T)
c = T.getObjectType()
print(c .." No worries" )
Camera works fine, but GameState is suspect.... when i pass the camera (T) into the function addCamera and step in it with the debugger, it becomes nil.
Is there something about environments in modules that i am missing?
here is what the gamestate module looks like.
local _G = _G
module(...)
local M = {}
M = _G.Class()
GameState = M
function M:__constructor()
-- Array of Cameras, 0 is default?
self.Cameras = {}
end
-- the following are getters and adders for the respective objects stored by the game state
function M:getCamera(id)
return self.Cameras[id]
end
function M:addCamera(camera) --this is nil.. what the heck?
self.Cameras[camera.getID()] = camera
end
thanks for any help!
-Joe