Variable is nil even I set it to a value (SOLVED)

local direction
local prev_direction

function init(self)
	msg.post(".", "acquire_input_focus")
	self.direction = vmath.vector3(0, 0, 0)
	self.prev_direciton = self.direction
	print(self.prev_direction)
end

Hello everyone. Why prev_direction is still nil?

It’s just a typo. You have 'self.prev_direciton' instead of 'self.prev_direction'.

6 Likes