GHI_Comm

Pilus edited this page Aug 11, 2015 · 1 revision

Syntax

obj = GHI_Comm() obj.function()

Functions

AddRecieveFunc(prefix, rcvFunc)

Arguments

prefix
''String''
This is a string used to identify a command sent for processing by a function.
rcvFunc
''Function''
When the prefix is received it will execute this function.
'''Note:''' This function can process arguments passed with GHI_Comm().Send() The arguments are passed in order to the rcvFunc.

Send(prio, target, prefix, ...)

Arguments

prio
''String''
This is a string that states the priority of the message. Normally it should be set to "NORMAL".
target
''String''
This is the intended recipient of the addon message.
prefix
''String''
This is the prefix string being sent to trigger a function.
...
''Any''
These are additional arguments to be passed when sending.
## Example > `local pingComm = GHI_Comm()`

local pinger = function(name)

print(name.." pinged you.")

end

pingComm.AddRecieveFunc("PING",pinger)

local pingComm = GHI_Comm()

local name = UnitName("player")

local targ = UnitName("target")

pingComm.Send("NORMAL", targ , "PING", name)

This script acts as a sender and receiver for pinging a target. You can test it on yourself by targeting yourself and using the item.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.