Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
declaring local variables in the game loop help - Gideros Forum

declaring local variables in the game loop help

MoKaLuxMoKaLux Member
edited November 7 in General questions
hope you are all doing fine :)
Can you please share your lua knowledge?
I have some variables in the game loop of a class, what's the best way to declare them?
  1. in the init as self?
  2. outside as local?
  3. or create them in the game loop?
local vx, vy -- here?
 
function LF_Dynamic_Character_Base:init(xworld, xparams)
	self.vx, self.vy -- here?
end
 
function LF_Dynamic_Character_Base:onEnterFrame(e)
	self.posx, self.posy = self.body:getPosition()
	local vx, vy = self.body:getLinearVelocity() -- here?
end
Is it just a matter of taste?

Thank you.
my growING GIDEROS github repositories: https://github.com/mokalux?tab=repositories

Comments

Sign In or Register to comment.