A basic library for registering slash commands in the WAR interface.
If you're downloading this because an addon you want to use requires it, just extract it into the interface\addons directory, and that's all you need to do.
With LibSlash installed, you'll also be able to use /addon or /uimod to open the Addons window in-game.
If you're writing an addon and want to utilize LibSlash, place it in the proper addons directory along with your other addons. Then, add it as a dependency in your addon's .mod file, like so:
<Dependencies>
<Dependency name="LibSlash" />
</Dependencies>
This will ensure that LibSlash is loaded before your addon, so that its functions will be available for use.
To register a slash command handler, call LibSlash.RegisterSlashCmd() with the slash command you want to register (a string, NOT INCLUDING THE /) and a function to serve as the handler:
LibSlash.RegisterSlashCmd("myslash", function(input) MyAddonHandleSlash(input) end)
The single argument passed to the handler is a string containing the rest of the chat line entered after the initial slash command, so the above code would call MyAddonHandleSlash with an argument of "testing" if I typed "/myslash testing" at the command line.
Alternatively, LibSlash.RegisterWSlashCommand() can be used to register a handler to receive a wstring version of the chat line, instead of having it automatically translated to a string.
To unregister a slash command, use LibSlash.UnregisterSlashCmd("myslash") - the only argument it takes is a string specifying the slash command to unregister. You can also use LibSlash.IsSlashCmdRegistered("myslash") to see if a slash command is already registered, possibly by another addon.
Both the register and unregister functions will return true on success, or false on failure for any reason such as attempting to register a slash command which is already registered, or other silly things.
------------------------------------------------------------------------
r38 | aiiane | 2008-11-10 10:32:09 +0000 (Mon, 10 Nov 2008) | 1 line
Changed paths:
A /tags/v2.4-release (from /trunk:37)
Call any matched slash handler after passing down through the original function chain, to allow slash handlers to overwrite the chat variables used for SEND_CHAT_TEXT if they so desire.
------------------------------------------------------------------------
r37 | aiiane | 2008-11-10 10:31:28 +0000 (Mon, 10 Nov 2008) | 1 line
Changed paths:
M /trunk/.pkgmeta
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Call any matched slash handler after passing down through the original function chain, to allow slash handlers to overwrite the chat variables used for SEND_CHAT_TEXT if they so desire.
------------------------------------------------------------------------
r35 | aiiane | 2008-10-12 22:32:39 +0000 (Sun, 12 Oct 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Added API function LibSlash.GetSlashCommandList() to return a read-only list of registered slash commands.
------------------------------------------------------------------------
r33 | aiiane | 2008-10-06 02:33:05 +0000 (Mon, 06 Oct 2008) | 2 lines
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
LibSlash will now hide the "Use custom interface" checkbox whenever it's loaded, to prevent people from accidentally checking it without knowing what it does. Why exactly is this checkbox present in a place where it can't be disabled via the same method it was enabled?
Anywho, if you REALLY, TRULY know what you're doing, and for some godforsaken reason actually want to check this box, use /showcustomui to make the checkbox and entry field show up again. DON'T SAY I DIDN'T WARN YOU.
------------------------------------------------------------------------
r31 | aiiane | 2008-10-02 18:11:48 +0000 (Thu, 02 Oct 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Update for 1.01 patch.
------------------------------------------------------------------------
r29 | aiiane | 2008-09-28 10:59:46 +0000 (Sun, 28 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Added global function slash() to allow invocation of slash commands from /script (for easier usage of LibSlash slash commands in macros). Simply pass it the text in quotes (or L"" for wstring input) that would normally follow the / - for instance, the slash command '/blah test' would become '/script slash("blah test")' for a macro.
------------------------------------------------------------------------
r27 | aiiane | 2008-09-26 19:24:36 +0000 (Fri, 26 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Fixed leaked globals from hook handler.
------------------------------------------------------------------------
r25 | aiiane | 2008-09-23 09:32:16 +0000 (Tue, 23 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Add option to register a slash command to receive wstring input instead of string input (via RegisterWSlashCmd).
------------------------------------------------------------------------
r23 | aiiane | 2008-09-23 02:41:33 +0000 (Tue, 23 Sep 2008) | 2 lines
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
The principle of the matter.
~lart ckknight
------------------------------------------------------------------------
r21 | aiiane | 2008-09-13 22:35:46 +0000 (Sat, 13 Sep 2008) | 2 lines
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Added more informative debug error message for developers.
Slash commands are now case-insensitive.
------------------------------------------------------------------------
r19 | aiiane | 2008-09-11 08:50:16 +0000 (Thu, 11 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
BugFix - forced LibSlash to only check for slash commands at the start of chat entry, and not in the middle of chat.
------------------------------------------------------------------------
r17 | aiiane | 2008-09-09 18:51:56 +0000 (Tue, 09 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.mod
Added /addon and /uimod as default slash commands to open the mods window.
------------------------------------------------------------------------
r16 | aiiane | 2008-09-09 18:50:29 +0000 (Tue, 09 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
Added /addon and /uimod as default slash commands to open the mods window.
------------------------------------------------------------------------
r14 | aiiane | 2008-09-02 02:43:19 +0000 (Tue, 02 Sep 2008) | 1 line
Changed paths:
M /trunk/LibSlash.lua
M /trunk/LibSlash.mod
Use pcall() to invoke registered slash handlers, so we can fail gracefully if a handler errors out.
------------------------------------------------------------------------
r12 | aiiane | 2008-08-23 07:40:28 +0000 (Sat, 23 Aug 2008) | 1 line
Changed paths:
M /trunk/LibSlash.mod
Dep EASystem_LayoutEditor so that ChatWindow won't error out because it doesn't properly dep it itself. FFS Mythic.
------------------------------------------------------------------------
r10 | aiiane | 2008-08-20 06:19:24 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
M /trunk/LibSlash.mod
Bump to 1.1, let's make the addon name as WAR sees it match the addon name as we see it.
------------------------------------------------------------------------
r7 | aiiane | 2008-08-20 05:49:49 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
D /trunk/LibSlash
A /trunk/LibSlash.lua
A /trunk/LibSlash.mod
Fix paths :|
------------------------------------------------------------------------
r5 | aiiane | 2008-08-20 05:40:52 +0000 (Wed, 20 Aug 2008) | 6 lines
Changed paths:
A /trunk/.pkgmeta
M /trunk/LibSlash/LibSlash.lua
M /trunk/LibSlash/LibSlash.mod
Working commit. Basic addon to register slash commands.
- LibSlash.RegisterSlashCmd(string, function)
- LibSlash.UnregisterSlashCmd(string)
- LibSlash.IsSlashCmdRegistered(string)
The handler function is passed a string with everything after the command itself.
------------------------------------------------------------------------
r4 | aiiane | 2008-08-20 05:03:44 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
A /trunk/LibSlash
A /trunk/LibSlash/LibSlash.lua
A /trunk/LibSlash/LibSlash.mod
------------------------------------------------------------------------
r3 | aiiane | 2008-08-20 05:02:33 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
D /trunk/LibSlash.lua
D /trunk/LibSlash.mod
------------------------------------------------------------------------
r2 | aiiane | 2008-08-20 04:59:44 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
A /trunk/LibSlash.lua
A /trunk/LibSlash.mod
------------------------------------------------------------------------
r1 | root | 2008-08-20 04:54:12 +0000 (Wed, 20 Aug 2008) | 1 line
Changed paths:
A /branches
A /tags
A /trunk
"libslash/mainline: Initial Import"
------------------------------------------------------------------------