LibRockConsole-1.0

From WowAce Wiki
Jump to: navigation, search

API Documentation

Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.

:AddSlashCommand("name" , callback , ...)

Arguments

"name"
string - name of the command, in CONSTANT_CASE. Optional, default: uppercase version of the first-specified slash command.
callback
function or string - function or method name to call.
...
tuple or table - list of slash commands in the form "/word".

Notes

  • add a slash command, that will be called when someone types in the specified slash commands into the command line.
  • any slash commands will also register the lowercase version of them automatically.

Example

MyAddon.OnSlashCommand = function(self, command, text)
	assert(command == "/MyAddon")
	self:Print("Received", text)
end
MyAddon:AddSlashCommand("OnSlashCommand", "/MyAddon") -- same as :AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon") or :AddSlashCommand("MYADDON", "OnSlashCommand", { "/MyAddon" })

:CustomPrint(r , g , b , frame , delay , connector , ...)

Arguments

r
number - [0, 1] The red value. Optional, default: nil
g
number - [0, 1] The green value. Optional, default: nil
b
number - [0, 1] The blue value. Optional, default: nil
frame
Frame - The MessageFrame to print to. Optional, default: self.printFrame or DEFAULT_CHAT_FRAME
delay
number - The amount of seconds to show. Optional, default: nil
connector
string or boolean - what to connect the multiple arguments with. If true, then it will print it literally. Optional, default: ", "
...
value - value to print

Notes

  • print a message to the specified message frame.

Example

MyAddon:CustomPrint(0, 1, 0, nil, nil, ", ", "Hello", "friend") -- prints "MyAddon: Hello, friend" in green.

:HasSlashCommand("name")

Arguments

"name"
string - name of the command, in CONSTANT_CASE.

Returns

boolean - whether the slash command is registered and to the current object

Example

MyAddon.OnSlashCommand = function(self, command, text)
	assert(command == "/MyAddon")
	self:Print("Received", text)
end
MyAddon:AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon")
assert(MyAddon:HasSlashCommand("MYADDON"))

:Print(...)

Arguments

...
tuple - list of values to print

Notes

  • print a message to the specified message frame, separated by commas.

Example

MyAddon:Print("Hello", "friend") -- print "MyAddon: Hello, friend"
Rock("LibRockConsole-1.0"):Print("Hello", "friend") -- print "Hello, friend"

:PrintLiteral(...)

Arguments

...
tuple - list of values to print

Notes

  • print a message in literal format, separated by commas.

Example

MyAddon:Print("Hello", "friend") -- print 'MyAddon: "Hello", "friend"'
Rock("LibRockConsole-1.0"):Print("Hello", "friend") -- print '"Hello", "friend"'

:RemoveAllSlashCommands()

Notes

  • remove all slash commands for the object.

Example

MyAddon.OnSlashCommand = function(self, command, text)
	assert(command == "/MyAddon")
	self:Print("Received", text)
end
MyAddon:AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon")
MyAddon:RemoveAllSlashCommands()
-- now /MyAddon does nothing.

:RemoveSlashCommand("name")

Arguments

"name"
string - name of the command, in CONSTANT_CASE.

Notes

  • remove a slash command by name

Example

MyAddon.OnSlashCommand = function(self, command, text)
	assert(command == "/MyAddon")
	self:Print("Received", text)
end
MyAddon:AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon")
MyAddon:RemoveSlashCommand("MYADDON")