Associated Lua - WoW

I play with Lua and World of Warcraft (AKA WoW) for about 2 days.

My problem is that when I use the following code (not as a macro, but as AddOn)

TimeManagerClockButton:Hide()

it gives me the following error message.

Message: Interface \ AddOns \ WeakCloudUI \ WeakCloudUI.lua: 22: attempt to index the global "TimeManagerClockButton" (nil value)
Time: 07/04/15 21:38:16
Quantity: 1
Stack: interface \ AddOns \ WeakCloudUI \ WeakCloudUI.lua : 22: in the main fragment

Locales: (* temporarily) = nil
(* temporarily) = nil
(* temporarily) =
(* temporarily) = 13
(* temporarily) = "OUTLINE"
(* temporarily) = true
(* temporarily) = 30
(* temporarily) =
(* temporarily) = nil
(* temporarily) = nil
(* temporarily) = "attempt to index the global value TimeManagerClockButton (nil value)"

It works fine as a macro, but the problem occurs when I use this code in AddOn (lua file).

Can someone please tell me what is the problem?

Thank.

+4
source share
1 answer

As suggested, you are probably running the code before TimeManagerClockButton exists, because the add-on code is not yet loaded.

assert(LoadAddOn("Blizzard_TimeManager"))

, , .

+2

All Articles