Thread Tools Display Modes
12-15-07, 07:27 PM   #1
Tatheltek
A Cyclonian
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 43
On update not working

XML
Code:
				
<OnLoad>
        self_timeSinceLastUpdate = 0
</OnLoad>
LUA
Code:
	
Backlash_UpdateInterval = 2.0
			
function Backlash_OnUpdate(self, elapsed)
  	self.timeSinceLastUpdate = self.timeSinceLastUpdate + elapsed; 	

  	while (self.timeSinceLastUpdate > Backlash_UpdateInterval) do
		BacklashMainFrame:Hide();

    	self.timeSinceLastUpdate = self.timeSinceLastUpdate - Backlash_UpdateInterval;
  	end
end

Error:
Interface\AddOns\Backlash\Backlash.lua:42: attempt to perform arithmetic on field 'timeSinceLastUpdate' (a nil value)
Count: 99

Call Stack:
[C]: ?
Interface\AddOns\Backlash\Backlash.lua:42: in function `Backlash_OnUpdate'
[string "*:OnUpdate"]:1: in function <[string "*:OnUpdate"]:1>

Line 41 is: self.timeSinceLastUpdate = self.timeSinceLastUpdate + elapsed;

Last edited by Tatheltek : 12-15-07 at 07:41 PM.
  Reply With Quote
12-15-07, 07:52 PM   #2
Siz
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 52
Did you mean to have an underscore in "self_timeSinceLastUpdate"

You could just use a global variable.

Or just add:

if not self.timeSinceLastUpdate then self.timeSinceLastUpdate = 0 end
  Reply With Quote
12-15-07, 08:29 PM   #3
Tatheltek
A Cyclonian
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 43
no that was not intended...thanks for the help
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » On update not working


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