ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Mysterious nil function error (https://www.esoui.com/forums/showthread.php?t=6582)

Aetheron 10/22/16 09:17 AM

Mysterious nil function error
 
Hi All,
Combat Reticle occasionally causes an error on load - usually when loading a character for the first time, but also sometimes after fast travel (I think). The error message says:

CombatReticle_Update:3: function expected instead of nil
stack traceback:
CombatReticle_Update:3: in function '(main chunk)'

So, there is no function 'CombatReticle_Update' in my code. Where does this string come from? I'm guessing it has to do with either event registrations in the init code, or perhaps the control binding xml (<TopLevelControl name="CombatReticle" movable="false"><OnUpdate>...). Any ideas?

I do register several (4) events in the initial load function - is it possible that the game engine is calling to some of these before the are all registered? (I don't think that would cause the problem since all vars that are referenced in the handlers are already initialized)

Any help would be appreciated.

-A

Baertram 10/22/16 09:34 AM

Try to change the order in your manifest txt file so the XML file will be executed after the lua file of the addon.
Otherwise the "OnUpdate" funciton is not globally known for the XML I guess.

Code:

## APIVersion: 100016 100017
## Title: Combat Reticle
## Description: Customizable context-senstitve reticle
## Version: 1.5.1
## Author: Aetheron, updated by |c4EFFF6Calia1120|r
## OptionalDependsOn: LibAddonMenu-2.0
## SavedVariables: CombatReticle_Settings

## Libraries:
Libs/LibStub/LibStub.lua
Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua

## Core:
CombatReticle.lua
CombatReticle.xml
CombatReticleSettings.lua
CombatReticleThemes.lua
Bindings/Bindings.xml
Bindings/Bindings.lua


Aetheron 10/22/16 09:59 AM

Alos, I am using the LibAddonMenu which contains a lot of code - including event register/unregister stuff. Has anyone seen any issues with this on other addons?

-A

votan 10/22/16 10:01 AM

Quote:

Originally Posted by Baertram (Post 28631)
Try to change the order in your manifest txt file so the XML file will be executed after the lua file of the addon.
Otherwise the "OnUpdate" funciton is not globally known for the XML I guess.

Code:

## APIVersion: 100016 100017
## Title: Combat Reticle
## Description: Customizable context-senstitve reticle
## Version: 1.5.1
## Author: Aetheron, updated by |c4EFFF6Calia1120|r
## OptionalDependsOn: LibAddonMenu-2.0
## SavedVariables: CombatReticle_Settings

## Libraries:
Libs/LibStub/LibStub.lua
Libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua

## Core:
CombatReticle.lua
CombatReticle.xml
CombatReticleSettings.lua
CombatReticleThemes.lua
Bindings/Bindings.xml
Bindings/Bindings.lua


Yes, I did that long time ago and do not have this error anymore.
Your TopLevelWindow is so "simple", you may want get rid of the xml and create it and register the handler in Lua.
On global function less.

Aetheron 10/22/16 10:34 AM

I've made this change to the manifest and will test with it for a while. The error is so rare it's going to be hard to know when it's fixed. Thanks all for the help!

-A

Aetheron 10/29/16 08:41 AM

I've just update Combat Reticle with this fix. I've been "testing" heavily for the past week and have not seen the error. So, thanks once again for the help! :)

-A


All times are GMT -6. The time now is 02:00 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI