vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 This Lib is made ofr Silvanas Addon it gives some commen functions like print,printf,select,varprint
3 --i use it so i dont have to redecleare the function so i wont use duoble memory space it u have multiple silvanas addons installed
4 --it is not a stand along addon jsut a file to include and other ui mods are welkome ot use it aslog as they dont moddify it :P
5  
6 --well that all
7 ]]--
8  
9 SilvanasLibVersion = 1.1
10  
11 if (not Silvanas) or (Silvanas.Version < SilvanasLibVersion) then
12  
13 Silvanas = {
14 --Libary version
15 Version = SilvanasLibVersion,
16 --hold a list of mods and thier info of registred mods
17 LoadedMods = {},
18  
19 --Basic print function
20 Print = function(msg)
21 if msg and DEFAULT_CHAT_FRAME then
22 DEFAULT_CHAT_FRAME:AddMessage(msg)
23 end
24 end,
25  
26 --Basic print function to the 2nd chat window
27 Print2 = function(msg)
28 if msg and ChatFrame2 then
29 ChatFrame2:AddMessage(msg)
30 elseif msg then
31 DEFAULT_CHAT_FRAME:AddMessage(msg)
32 end
33 end,
34  
35 --Print whit text formatting
36 Printf = function(...)
37 Silvanas.Print(string.format(unpack(arg)))
38 end,
39  
40 --Returns a string represention of the variable
41 VarPrint = function(variable)
42 local vartype = type(variable)
43 if vartype == "string" then
44 return variable
45 elseif vartype == "number" then
46 return tostring(variable)
47 elseif vartype == "boolean" then
48 if variable then
49 return "true"
50 else
51 return "false"
52 end
53 else
54 return vartype
55 end
56 end,
57  
58 --Argument selector
59 Select = function(num,...)
60 return arg[num]
61 end,
62  
63 --Popup message
64 Message = function(msg)
65 message("|cFFFFFFFF".. msg .."|r")
66 end,
67  
68 --/ Command addfunction
69 AddCmd = function(Name,Function,CmdTable)
70 if (type(CmdTable) == "table") and (type(Function) == "function") and (type(Name) == "string") then
71 local i,max
72 max = table.getn(CmdTable)
73  
74 if max > 0 then
75 SlashCmdList[Name] = Function
76  
77 for i=1,max,1 do
78 setglobal("SLASH_".. Name .. i,"/".. CmdTable[i])
79 end
80 end
81 else
82 return
83 end
84 end,
85  
86 --Registers a mod in the libary (removed)
87 AddMod = function(modtable)
88 end,
89 }
90 end