|
||||||
| Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding]. | ||||||
![]() |
|
|
Thread Tools |
|
|
#1 | |
|
Member
Join Date: Aug 2010
Posts: 14
|
Another reason why variable localization is important! Source: http://us.battle.net/wow/en/forum/topic/7005434873
So anyone got a good script that can do static code analysis on Lua files to detect global variables? Quote:
|
|
|
|
|
|
|
#2 |
|
Hero Member
Join Date: Feb 2007
Posts: 817
|
FindGlobals in combination with the nppExec scripts and settings found in the comments works great.
|
|
|
|
|
|
#3 |
|
Never give up!
Join Date: Nov 2005
Location: Scotland, UK
Posts: 2,960
|
Or if you don't want to use FindGlobals, simply set your taintLog to a value of 2 (though I recommend setting it back to 0 or 1 when you're done). That will record the "tainting" of every global variable and can help debugging which addon is the cause. Calling it "almost impossible to track down" is a bit of an overstatement.
Last edited by funkydude; 11-06-2012 at 02:34 PM. |
|
|
|
|
|
#4 | |
|
Member
Join Date: Aug 2010
Posts: 14
|
Quote:
![]() Thanks for the info. |
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jan 2006
Location: Sweden
Posts: 358
|
Before I go pulling my hair out trying to do this myself, any hints on how to use FindGlobals to.. oh, say looking for global underscores among all addons at once?
Edit: Hair still intact, and I managed somehow. Don't know if there's a better solution (or whether this actually works for all cases), but I changed line 115 in globals.lua Code:
if globalName and GLOBALS[globalName] then Code:
if globalName and GLOBALS[globalName] or globalName ~= "_" then Code:
@echo off
set LUAC="C:\Games\Blizzard\World of Warcraft\Interface\luac-wow.exe"
set LUA="C:\Games\Blizzard\World of Warcraft\Interface\lua-wow.exe"
set FINDGLOBALS="C:\Games\Blizzard\World of Warcraft\Interface\FindGlobals.lua"
for /r %%a in ("\*.lua") do %LUAC% -p -l "%%a" | %LUA% %FINDGLOBALS% "%%a"
pause
__________________
Grab your sword and fight the Horde! Shattered Hand-EU Last edited by Lombra; 11-07-2012 at 01:07 PM. |
|
|
|
|
|
#6 |
|
Seal Cub Clubbing Club
Join Date: May 2005
Location: California, US
Posts: 7,805
|
Here is a GUI wrapper for FindGlobals:
http://www.wowinterface.com/download...OTANADDON.html
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge Troubleshoot an addon | Turn any code into an addon | More addon resources Need help with your code? Attach or paste your whole, real files. Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead! |
|
|
|
|
|
#7 | |
|
Amazing Member
|
Quote:
|
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT. The time now is 11:46 PM.
WowAce Forums







