Thread Tools Display Modes
06-03-11, 12:31 PM   #1
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
Help with Error

Hey guys im working on a mod i used to maintane way back when (last version was 30100)

i got it 98% working still one error and a few tweeks to do yet

anyway im getting a error and i cant figure out how to fix it

Here's the error

Code:
Date: 2011-06-04 03:45:06
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\SetWrangler\SetWrangler.lua line 718:
   attempt to perform arithmetic on local 'elapse' (a nil value)
Debug:
   [C]: ?
   SetWrangler\SetWrangler.lua:718: SetWrangler_OnUpdate()
   [string "*:OnUpdate"]:1:
      [string "*:OnUpdate"]:1
AddOns:
  Swatter, v5.12.5165 (QuirkyKiwi)
  SetWrangler, v
  Titan, v5.0.5.40100 - Revision 519
  BlizRuntimeLib_enUS v4.1.0.40100 <us>
  (ck=81)
Heres the code

from the Lua (line 718 is highlighted)
Code:
function SetWrangler_OnUpdate(self, elapse)
    if (gDoCacheTimer == 1) then
        --dout("Update: "..gCacheTimer);
        gCacheTimer = gCacheTimer + elapse;

        if (gCacheTimer > SW_CACHE_TIMER) then
            gDoCacheTimer = 0;
            gCacheAttempts = gCacheAttempts + 1;

            if (gCacheAttempts <= SW_MAX_CACHE_ATTEMPTS) then
                gCacheData.callback(gSelectedSet,1);
            else
                nameLocationText:SetText("Failed to load link...");
            end
        end
    end    
end
from the xml
Code:
            <OnUpdate>
                SetWrangler_OnUpdate(self, elapse);
            </OnUpdate>
thanks for any and all help.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
06-03-11, 01:05 PM   #2
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
Silly question perhaps, but when declaring it via xml does it have to literally be elapsed for it to work?

And are there any errors in FrameXML.log?
__________________
Oh, the simulated horror!
  Reply With Quote
06-04-11, 05:05 AM   #3
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
Originally Posted by Ailae View Post
Silly question perhaps, but when declaring it via xml does it have to literally be elapsed for it to work?
Im not sure about that i didnt write the mod im just keeping it going where i can.

Originally Posted by Ailae View Post
And are there any errors in FrameXML.log?
No its not producing any errors in the FrameXML.log.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
06-04-11, 09:51 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
<OnUpdate function="SetWrangler_OnUpdate"/>
  Reply With Quote
06-04-11, 02:33 PM   #5
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Code:
<OnUpdate>
                SetWrangler_OnUpdate(self, arg1);
            </OnUpdate>
Should make it work because the argument "arg1" will be passed on.
Before, "elapse" was nil because the OnUpdate function has no argument/variable called 'elapse' but a argument called 'arg1'.



Originally Posted by p3lim View Post
<OnUpdate function="SetWrangler_OnUpdate"/>
This will also suit your needs because this will call the SetWrangler_OnUpdate function with all parsed keys.
e.g.: SetWrangler_OnEvent(self, event, ...)
'...' contains all following parameters/arguments.


LINKS:
http://www.wowpedia.org/UIHANDLER_OnUpdate
http://www.wowpedia.org/Using_OnUpdate_correctly
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker

Last edited by humfras : 06-04-11 at 03:52 PM. Reason: added links
  Reply With Quote
06-04-11, 08:51 PM   #6
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
i tried both still getting the error, i added the mod im working on if anyone wants to take a look at it.
Attached Files
File Type: zip SetWrangler.zip (159.2 KB, 664 views)
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
06-05-11, 04:30 AM   #7
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Your original code would have worked if you had written elapsed instead of elapse. The suggestion p3lim came with will also work, but in the zip above you have defined your OnUpdate handler twice.

The first suggestion humfras came with isn't correct, as arg1 doesn't exist anymore. This is also your current second definition of OnUpdate, so it overrides the correct one.

Also, I would recommend you to tell people how they can recreate the error, especially when you hand them a couple of thousand lines of Lua and XML.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
06-05-11, 11:12 AM   #8
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
ok i got the error sorted thanks for the help, the next problem is that when you click the link button no items are linked to the selected channel.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
06-05-11, 02:08 PM   #9
humfras
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 131
Originally Posted by haste View Post
The first suggestion humfras came with isn't correct, as arg1 doesn't exist anymore. This is also your current second definition of OnUpdate, so it overrides the correct one.
I had written 'elapsed' based on my memory but took a look @wowpedia to ensure and it stated 'arg1'.
__________________
Author of VuhDo CursorCastBar OptiTaunt Poisoner RaidMobMarker
  Reply With Quote
06-05-11, 02:22 PM   #10
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Originally Posted by humfras View Post
I had written 'elapsed' based on my memory but took a look @wowpedia to ensure and it stated 'arg1'.
And I hope you have corrected in the wiki ... :P
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with Error

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off