Code: Select all
self.m_physObj.m_body:getX(), self.m_physObj.m_body:getY()
At first glance though, this looks like it'd be a lot neater if I just wrote out a function
Code: Select all
function PhysicsObject:GetX()
return self.m_body:getX()
end
Code: Select all
self.m_physObj.m_body:getX(), self.m_physObj.m_body:getY()
Code: Select all
function PhysicsObject:GetX()
return self.m_body:getX()
end
Now if you absolutely need to access just the body's X position then go right ahead. But note this this a rare case that happens much less often and you don't need a wrapper for it.I'll need to directly access the separate objects' variables inside this wrapper class
The JIT can inline calls, but in this case the C call will prevent the trace to be compiled (LuaJIT 2.0).
Users browsing this forum: Ahrefs [Bot] and 11 guests