View Single Post
04-02-20, 08:46 AM   #1
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 12
Why ReloadUI() method causes mistake

I'm trying to call ReloadUI() method after one minute. This is code I'm using.
Code:
local isEnd = false

local f = CreateFrame("Frame")
function f:onUpdate(sinceLastUpdate)
   if isEnd then
      print("END")
      f:SetScript("OnUpdate",nil)
      ReloadUI()
   end
   
   self.sinceLastUpdate = (self.sinceLastUpdate or 0) + sinceLastUpdate
   if ( self.sinceLastUpdate >= 60 ) then -- in seconds
      -- do stuff here
      print("MSG")
      self.sinceLastUpdate = 0
      isEnd = true
   end
end
f:SetScript("OnUpdate",f.onUpdate)
When the minute passes I get an error:
Click image for larger version

Name:	error.png
Views:	265
Size:	35.7 KB
ID:	9433
How to fix this? Or any ideas how to make one minute delay?
I found other function on https://wowwiki.fandom.com/wiki/USERAPI_wait
Code:
 <PREFIX>_wait(delay, func [, param [,param [,...]]])
But I don't understand how to use it. What is <PREFIX>? And code example on same link not working.
  Reply With Quote