Syntax error near 'msg' (SOLVED)

help me please here
this is the error:
Line 38: Compilation failed: syntax error near 'msg'

this is the code:
local data = require(‘main.data’)

function init(self)
	sprite.set_constant('#sprite', 'tint', data.color_one)
	sprite.set_constant('line#sprite', 'tint', vmath.vector4(0, 0, 0, 0.05))
	self.speed = 46
	self.direction = math.random(1,2)
	local line_width = go.get('line#sprite', 'size.x')
	local circle_width = go.get('#sprite', 'size.x')
	data.line_edge_left = data.mid_x - (line_width/2)
	data.line_edge_right = data.mid_x + (line_width/2)
	self.left_x = data.line_edge_left + (circle_width/2)
	self.right_x = data.line_edge_right - (circle_width/2)
	if self.direction == 1 then
		go.set('.', 'position.x', self.left_x)
	else
		go.set('.', 'position.x', self.right_x)
	end
end


local function move(self)
	go.cancel_animations('.', 'position.x')

	local new_x = (self.direction == 1) and self.right_x or self.left_x
	local duration = data.duration(self.speed, go.get_position().x, new_x)
	go.animate('.', 'position.x', go.PLAYBACK_LOOP_FORWARD, new_x, go.EASING_LINEAR, duration, 0, function()
		move(self)
		msg.post('main:/sound#rebound', 'play_sound')
	end)
	self.direction = (self.direction == 1) and 2 or 1
	
end

local function end_game(self)
	msg.post('.', 'release_input_focus')
	go,cancel_animation('.', 'position.x')
	msg.post('.', 'disable')
	local function emitter_state_change(self, id, emitter, state)
		if state == particlefx.EMITTER_STATE_SLEEPING then
			msg.post('container', 'end_game')
		end
	end
	particlefx.play('#explode', emitter_state_change)
	particlefx.set_constant('circle#explode', 'emitter', 'tint', data.color_one)
	msg.post('main:/sound#explode', 'play_sound')
end

local function increase_speed(self)
	if self.speed<56 then
		self.speed = self.speed = 0.45
	elseif self.speed < 64 then
		self.speed = self.speed + 0.2
	end
end

function on_message(self, message_id, message, sender)
	if message_id ==  hash('start') then
		go.animate('.', 'scale', go.PLAYBACK_LOOP_FORWARD, 1, go.EASING_LINEAR, 0.3)
		move(self)
		msg.post('.', 'acquire_input_focus')
	elseif message_id == hash('increase_speed')then
		increase_speed(self)
	elseif message_id == hash('end_game')then
	end_game(self)
	end
end

function on_input(self, action_id, action)
	if action_id == hash('touch') and action.pressed then
		move(self)
		msg.post('main:/sound#move', 'play_sound')
	end
end

Are you sure this is all the code? There don’t seem to be 38 lines, and I don’t see msg anywhere.

local function end_game(self)
msg.post(’.’, ‘release_input_focus’)
go,cancel_animation(’.’, ‘position.x’)
msg.post(’.’, ‘disable’) this is line 38
local function emitter_state_change(self, id, emitter, state)
if state == particlefx.EMITTER_STATE_SLEEPING then
msg.post(‘container’, ‘end_game’)
end
end
particlefx.play(’#explode’, emitter_state_change)
particlefx.set_constant(‘circle#explode’, ‘emitter’, ‘tint’, data.color_one)
msg.post(‘main:/sound#explode’, ‘play_sound’)
end

try msg.post(get.go(), “disable”)
I think the “.” is related to the script itself and not the gameobject
I could be wrong

The “.” is shorthand for “this game object”.
“#” is shorthand for “this script”.

1 Like

solved thanks

and, for posterity (i.e. helping others), what was the problem?

2 Likes

This, surely, line 37:

2 Likes

And this typo won’t work either

1 Like

lol