feat: add WoW utility functions and SlashCmdList for addon slash commands

Utility functions:
- strsplit(delim, str), strtrim(str), wipe(table)
- date(format), time() — safe replacements for removed os.date/os.time
- format (alias for string.format), tinsert/tremove (table aliases)

SlashCmdList system:
- Addons can register custom slash commands via the standard WoW pattern:
  SLASH_MYADDON1 = "/myaddon"
  SlashCmdList["MYADDON"] = function(args) ... end
- Chat input checks SlashCmdList before built-in commands
- dispatchSlashCommand() iterates SLASH_<NAME>1..9 globals to match

Total WoW API surface: 23 functions + SlashCmdList + 14 events.
This commit is contained in:
Kelsi 2026-03-20 11:40:58 -07:00
parent 52a97e7730
commit c1820fd07d
3 changed files with 163 additions and 1 deletions

View file

@ -26,10 +26,12 @@ public:
void setGameHandler(game::GameHandler* handler);
// Fire a WoW event to all registered Lua handlers.
// Extra string args are pushed as event arguments.
void fireEvent(const std::string& eventName,
const std::vector<std::string>& args = {});
// Try to dispatch a slash command via SlashCmdList. Returns true if handled.
bool dispatchSlashCommand(const std::string& command, const std::string& args);
lua_State* getState() { return L_; }
bool isInitialized() const { return L_ != nullptr; }