Defining a new global variable or function that begins with a lowercase letter in a behavior places that variable or function in the behavior's environment, effectively making it local to that environment.

Certain functions bind properties to globals in your behavior's environment. The only ones that currently exist are cvar() and cvarbool(), which provide shorthand access to WoW's configuration variables. For example:

Code:

music = cvarbool "Sound_EnableMusic"

After that call, the music variable is bound to the current value of the "Sound_EnableMusic" configuration variable.

Certain functions, when called before a function definition, define triggers for that function. When any trigger's condition is satisfied, the associated function is executed. No triggers will fire when their behavior is disabled. For example:

Code:

trigger "load" function hello()
-- This function is called when the behavior is enabled.
end
trigger "unload" function goodbye()
-- This function is called when the behavior is disabled.
end
event "player regen (enabled, disabled)" function combat()
-- This function is called when the player enters or leaves combat.
end

If you define a function in your behavior with the same name as a global function, your defined function hooks (instead of replacing) the existing global function.

The function print(...) writes all of its parameters to the default chat frame.

trigger("names"[, ...]) • Causes the function to be executed when a given trigger or triggers are fired. The only triggers fired currently are "load" and "unload", when your behavior is enabled or disabled, respectively.

hook([table,] "names"[, ...]) • Causes the function to become a secure hook of the function(s) with the given name(s) on the specified table (by default, the global environment).

hookscript(obj or "name", "scripts"[, ...]) • Causes the function to become a secure hook of the specified handler(s) of the given frame.

event("names"[, ...]) • Causes the function to be executed when the given event or events are received.

slash("name") • Causes the function to become a slash command /name.

Any string argument of any trigger that can take a variable of arguments can contain a comma-separated list of values, and can also contained parenthesized expressions to an arbitrary depth. Examples:

function ChatEdit_SetLastTellTarget(name)
lastTell = (name ~= "") and name or nil
end
function ChatEdit_SetLastToldTarget(name)
if name and name ~= "" then
lastTold, timeout = name, GetTime() + 30
else
lastTold, timeout = nil, nil
end
end
hook "ChatFrame_ReplyTell(2)" function reply(frame)
if timeout and GetTime() > timeout then
lastTold, timeout = nil, nil
end
local name = lastTold or lastTell
if name then ChatFrame_SendTell(name, frame) end
end

Whisper the target of your Innervate spell (change "Innervate" to the name of any buff):

This is an awsome mod, and it came along at just the right time. Im just trying to learn lua coding in WoW and between this mod and the "WoWlua" mod (in the dev catagory) should make experimenting with the code much easyer.

Originally posted by 0Blackmage0 This is an awsome mod, and it came along at just the right time. Im just trying to learn lua coding in WoW and between this mod and the "WoWlua" mod (in the dev catagory) should make experimenting with the code much easyer.