LibRockConsole-1.0
From WowAce Wiki
Contents |
[edit]
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
[edit]
:AddSlashCommand("name" , callback , ...)
[edit]
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".
[edit]
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.
[edit]
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" })
[edit]
:CustomPrint(r , g , b , frame , delay , connector , ...)
[edit]
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
[edit]
Notes
- print a message to the specified message frame.
[edit]
Example
MyAddon:CustomPrint(0, 1, 0, nil, nil, ", ", "Hello", "friend") -- prints "MyAddon: Hello, friend" in green.
[edit]
:HasSlashCommand("name")
[edit]
Arguments
- "name"
- string - name of the command, in CONSTANT_CASE.
[edit]
Returns
boolean - whether the slash command is registered and to the current object
[edit]
Example
MyAddon.OnSlashCommand = function(self, command, text)
assert(command == "/MyAddon")
self:Print("Received", text)
end
MyAddon:AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon")
assert(MyAddon:HasSlashCommand("MYADDON"))
[edit]
:Print(...)
[edit]
Arguments
- ...
- tuple - list of values to print
[edit]
Notes
- print a message to the specified message frame, separated by commas.
[edit]
Example
MyAddon:Print("Hello", "friend") -- print "MyAddon: Hello, friend"
Rock("LibRockConsole-1.0"):Print("Hello", "friend") -- print "Hello, friend"
[edit]
:PrintLiteral(...)
[edit]
Arguments
- ...
- tuple - list of values to print
[edit]
Notes
- print a message in literal format, separated by commas.
[edit]
Example
MyAddon:Print("Hello", "friend") -- print 'MyAddon: "Hello", "friend"'
Rock("LibRockConsole-1.0"):Print("Hello", "friend") -- print '"Hello", "friend"'
[edit]
:RemoveAllSlashCommands()
[edit]
Notes
- remove all slash commands for the object.
[edit]
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.
[edit]
:RemoveSlashCommand("name")
[edit]
Arguments
- "name"
- string - name of the command, in CONSTANT_CASE.
[edit]
Notes
- remove a slash command by name
[edit]
Example
MyAddon.OnSlashCommand = function(self, command, text)
assert(command == "/MyAddon")
self:Print("Received", text)
end
MyAddon:AddSlashCommand("MYADDON", "OnSlashCommand", "/MyAddon")
MyAddon:RemoveSlashCommand("MYADDON")

