WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Can anyone help me troubleshoot real short code (https://www.wowinterface.com/forums/showthread.php?t=57604)

Dissosiative 10-15-19 12:54 PM

Can anyone help me troubleshoot real short code
 
https://github.com/Rootkit-/Devil/bl...ersClassic.lua

I have no idea why its not running.

myrroddin 10-15-19 09:07 PM

Maybe I am missing something at first glance, but you don't define "DevilHunters" anywhere as an addon.
Code:

local DevilHunters = {}

-- OR

local name, DevilHunters = ...

One of these two should be the very first line of your code.

Urtgard 10-16-19 02:00 AM

Line 119: Your addon is called "DevilsHuntersClassic" and not "DevilsHunters"

And all the functions and variables you use should be locals.

Quote:

One stumbling block for Lua programmers coming from other languages is the fact that all variables are global unless specified otherwise. Many times, the use of global variables is necessary: saved variables are created via the global environment; all API functions and UI frames are in the global namespace. However, globals come at a cost of both performance, and naming conflicts.

Globals are inefficient to access compared to locals. Whenever a global is accessed, Lua has to call the internal equivalent of getfenv() to figure out where to retrieve the global from. Local variables, on the other hand, are stored on a stack.

https://wow.gamepedia.com/UI_best_pr...ocal_variables


All times are GMT -6. The time now is 11:08 PM.

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