Page 1 of 1

LunaLua:1: '=' expected near "onTick"

Posted: Wed Jun 08, 2022 9:49 am
by Someone
Tried following Enjl youtube tutorial. And error keeps popping up. Can someone help?

Code: Select all

Function onTick()
	if player.keys.up == KEYS_PRESSED then
		Misc.dialog("test1")
	elseif player.keys.up == KEYS_UNPRESSED then
		Misc.dialog("test2")
end
end

Re: LunaLua:1: '=' expected near "onTick"

Posted: Wed Jun 08, 2022 11:19 am
by Radiance
"Function" should be decapitalized so it's "function" instead.

Re: LunaLua:1: '=' expected near "onTick"

Posted: Wed Jun 08, 2022 11:21 am
by deice
also, there is an extra "end" keyword at the bottom that is superfluous.

Re: LunaLua:1: '=' expected near "onTick"

Posted: Wed Jun 08, 2022 11:24 am
by Radiance
deice wrote:
Wed Jun 08, 2022 11:21 am
also, there is an extra "end" keyword at the bottom that is superfluous.
The first end is just unindented so it's fine I think

Re: LunaLua:1: '=' expected near "onTick"

Posted: Wed Jun 08, 2022 11:26 am
by deice
Drifloon wrote:
Wed Jun 08, 2022 11:24 am
The first end is just unindented so it's fine I think
ah yea my bad, i didn't actually notice that the if statement wasn't closed above that. the only error is the wrong capitalization of "function".

Re: LunaLua:1: '=' expected near "onTick" (Solved)

Posted: Wed Jun 08, 2022 1:12 pm
by Someone
Thanks for help!

Added in 7 minutes 26 seconds:
Re: LunaLua:1: '=' expected near "onTick" (Not Solved)
Someone wrote:
Wed Jun 08, 2022 1:12 pm
Thanks for help!
...Uh...
Image

Re: LunaLua:1: '=' expected near "onTick" (Solved)

Posted: Wed Jun 08, 2022 1:33 pm
by deice
Someone wrote:
Wed Jun 08, 2022 1:20 pm
...Uh...
i corrected myself in the thread, the second end wasn't unnecessary (i didn't read the code correctly). also, you shouldn't put a semicolon after the function name.