You are mixking . and : metaphores in calling your function. When you use a : it implies a parameter of self. When you call that function using a . the first parameter needs to be the object or the arguments get shifted. In other words do either:
local a = Actor:new(200, 200, physics)
or
local a = Actor.new(200, 200, physics)
function Actor.new(x, y, physic)
//here physic should not be nil any longer.
end
Though I’m not sure why your passing physics as a parameter. When you load a module with require, there is only one copy of it. If your Actor:new function is in the same module as where you’re calling it, then you can just reference “physics” without passing it. If your Actor is a different module, just require physics at the top to get a local reference to it. While it’s not wrong to do what you do, it’s not something lua programmers do because of the way modules are really loaded.
Rob