Currently I have something in lua that is like OOP using tables.
TCharacterController = {}
TCharacterController.speed = 10.0
TCharacterController.axis = "x"
function TCharacterController:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function TCharacterController:update()
--this is a function that is called by the C application
end
The concept is that I will create a child object
ScriptObj = TCharacterController:new()
for each script instance attached to an object in my application (this is for a game). So I have an entity layer and all of the entities will have the ability to have a ScriptObj attached to them. My idea is that the Script is actually a class and it is instantiated for each entity it is attached too.
My question is, how do I instantiate the instance of the TCharacterController using the C API?