IGAS

This project is experimental.

This project is only experimental and may change drastically between now and when it comes out of experimental status. It may even be disapproved once that happens, worst-case.

Be forewarned before downloading anything from this project.

OOP_Set

This lib will provide a new platform for addons.

Visit my wiki for more informations.

IGAS's Wiki

You Can Use luadoc to create docs for this addon by steps

  1. Download Lua_V5.1.4-40.exe from http://code.google.com/p/luaforwindows/
  2. Install it to C:\lua
  3. Open a command console, change the folder to the Interace\Addon\, run lua C:\Lua\5.1\lua\luadoc_start.lua -d IGAS_out IGAS
  4. You'll find docs in the IGAS_out
  5. Visit my wiki for more informations

A simple introduction

* Addon

With the Addon system, you can make all your files working in a same Environment.

File A:

IGAS:NewAddon("MyAddon")

function MyGetAddonName()
    return "MyAddon"
end

File B:

  -- this would print "", because no MyGetAddonName in the _G
print(MyGetAddonName and MyGetAddonName())  

-- Create or get the addon, and set the Environment to the addon itself
IGAS:NewAddon("MyAddon")

-- this would print "MyAddon", because now  the Environment is the addon  with the Name "MyAddon"
print(MyGetAddonName and MyGetAddonName())
You can register events for the addon and get it easily.

File C:

IGAS:NewAddon("MyAddon")

-- _Addon is a reference to the Addon itself, 
-- by the way, _Name is the addon's  name,
-- _Version is the addon's version, visit the wiki for more informations.

-- Register event,the event can be system event or custom event.
_Addon:RegisterEvent("VARIABLES_LOADED")

-- Operation for VARIABLES_LOADED
function _Addon:VARIABLES_LOADED()
    print(" VARIABLES IS LOADED!!!")
end
You can add slash cmd and handle it easily.

File D:

IGAS:NewAddon("MyAddon")

_Addon:RegisterEvent("PLAYER_ENTERING_WORLD")

function _Addon:PLAYER_ENTERING_WORLD()
    -- Add slash commands
    self:AddSlashCmd("/myslash")
    self:AddSlashCmd("/myslash2")
end

-- OnSlashCmd is a script handler for addon
-- it'll be triggered when you type /myslash or /myslash2
function _Addon:OnSlashCmd(msg)
    print("My addon's slash cmd is triggered, and msg is "..msg)
end
You can managed your SavedVariables easily.

File E:

IGAS:NewAddon("MyAddon")

-- Add two SavedVariables, then after VARIABLES_LOADED, you can use them
-- to get or store dataes.
_Addon:AddSavedVariable("MyAddonSaveDB1“)
_Addon:AddSavedVariable("MyAddonSaveDB2“)

function DoSomething()
    MyAddonSaveDB1.SomeString = "HI"
    print(MyAddonSaveDB1.SomeString)
end
You can fire your custom event, to contact other frames or addons.

File F:

IGAS:NewAddon("MyAddon")

-- after this, all frames and addons that registered the MY_CUSTOM_EVENT_TEST
-- will receive the event.
_Addon:FireEvent("MY_CUSTOM_EVENT_TEST", "HI", "I am an addon")

Visit my wiki for more informations

* GUI lib

You can test these code in Cube

With this gui lib, you can create frames and modify it's property to change it in a easily way.

File A:

-- Create a form, this is a standard widget defined in the gui lib.
local fm = IGAS:NewFrame("Form", "MyTestForm")

-- easily modify it's width and height.No need using like fm:SetWidth(fm:GetWidth() + 100)
fm.Width = 400
fm.Height = 600

-- special property defined in gui lib, this Caption means the title of the form.
fm.Caption = "My First Test Form"
You can create your own widget that inherited from a standard widget.

File B:

local myTestWidget = IGAS:NewWidget({
                ["WidgetName"] = "myTestWidget",
		["Base"] = "Form",
		["FuncProxy"] = {},
		["Property"] = {},
		["ScriptType"] = {},
		["New"] = function(parent)
                    local frame = IGAS:NewFrame("Form", nil, parent)
                    return frame
                end,
})

It's too complex to explain all things about the gui lib, you may have a direct feeling by using IGAS_Studio

Visit wiki for more informations.

*Localization

These system is used to make addon localizationed. File A:

-- Create default local file. the third paramter is true.
local L = IGAS:NewLocal("Cube", "enUS", true)
if not L then return end

-- just like ace, if the value is true, the text's local is itself.
L["Simple Dev Tool"] = true

FIle B:

-- no third parameter. if the GetLocal() return the zhCN, this file would be used.
local L = IGAS:NewLocal("Cube", "zhCN")
if not L then return end

-- Change the local for the text
L["Simple Dev Tool"] = "简易开发工具"

File C:

-- ues it, only need the first paramter
local L = IGAS:NewLocal("Cube")

-- print the local string for the text
print(L["Simple Dev Tool"])

* Logger system

This system is used for authors to track their addons's running informations.

-- Addon Initialize
IGAS:NewAddon("MyAddon")

-- Create the logger and set it to the Log, just using the addon's name to the logger's name
Log = IGAS:NewLogger("MyAddon")

-- adjust the logger's log level
Log.LogLevel = 2

-- Set the logger's log-prefix for each log level
Log:SetPrefix(1, "[MyAddon:Debug]")
Log:SetPrefix(2, "[MyAddon:Info]")

-- Set the logger's log-timeformat, no need to set if you don't want know when a log is created.
Log.TimeFormat = "%X"

-- Add log handler to the logger, here we use print function as a log handler, the logger's logs would
-- be printed when they are created.You can add other handler functions for this, print is enoughful
Log:AddHandler(print)

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of izanamie izanamie Jul 15, 2010 at 12:27 UTC - 0 likes

    Hi there, i cant download the lib here, would you please be so kind and update your project and resubmit it to be aproved?

    Last edited Jul 20, 2010 by izanamie

    --------------------------------------------------------------------------------------------------------------
    Our time has come, get ready to fight, Sisters and brothers in Plate, unite!
    Blood-red the steel of our swords shall flow.
    Brace up, defend,
    Never ever be outdone in bravery.

    This is the way of the warrior.

  • 1 comment

Facts

Date created
Oct 16, 2009
Category
Last update
Aug 04, 2010
Development stage
Beta
License
GNU General Public License version 2 (GPLv2)
Downloads
89
Recent files
  • B: b1 for 3.3.5 Aug 04, 2010
  • A: a1 for 3.1.0 Apr 06, 2010

Authors