Created
June 1, 2016 08:01
-
-
Save winny-/da9b300188564aa0d93c490df9a3e14e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prn(s) | |
DEFAULT_CHAT_FRAME:AddMessage(s) | |
end | |
SLASH_SANDBOX1 = '/sandbox' | |
SlashCmdList['SANDBOX'] = function() prn('Sandbox loaded! :)') end | |
SLASH_EVAL1 = '/eval' | |
SlashCmdList['EVAL'] = function(s) | |
if s == nil or s == '' then | |
prn('Need lua expression') | |
return | |
end | |
local tmpl = [[ | |
local res = %s | |
if res == nil then | |
return 'nil' | |
else | |
return tostring(res) | |
end | |
]] | |
local fn = loadstring(string.format(tmpl, s)) | |
if fn == nil then | |
prn('Bad lua expression "' .. s .. '"') | |
else | |
local res = fn() | |
prn(res ~= nil and res or 'nil') | |
end | |
end | |
function lsAddons() | |
local n = GetNumAddOns() | |
if n == 0 then | |
prn("(No addons)") | |
return | |
end | |
for idx = 1, n do | |
prn(tostring(idx) .. ' "' .. GetAddOnInfo(idx) .. '" ' .. (IsAddOnLoaded(idx) and 'loaded' or '*not* loaded')) | |
end | |
end | |
prn('Sandbox successfully executed.') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment