04/25/17, 11:51 PM
|
#4
|
Join Date: Oct 2014
Posts: 577
|
Originally Posted by Rahon
Code:
ADDON_NAME = "Test"
EVENT_MANAGER: RegisterForEvent(ADDON_NAME,EVENT_MOUNTED_STATE_CHANGED, IsOnMount())
-- d(IsMounted("player"))
-- d(onMount)
local function IsOnMount(event, onMount)
if onMount == IsMounted("player")
then d("Mounting")
else d("Unmounting")
end
I'm guessing that it has something to do with "IsOnMount()" not receiving and/or the EVENT_MANAGER not giving away its variables - in this case the EventID and the Boolean value.
This is my first experience in coding in lua, so im glad for any help I can get.
cheers
|
- Welcome here
- IsOnMount() is a call not a reference. You write simply InOnMount, no brackets.
- In Lua nothing is known before it is declared. Means that IsOnMount is nil at the moment EVENT_MANAGER is used. You have to move it below the function declaration.
- ADDON_NAME should not be global, use the local keyword
greets.
|
|
|