Skip to content

LibAzerothCore-1.0 is a library for the World of Warcraft client that integrates with the AzerothCore server software. It provides a Lua interface that allows addon code to interact with server commands in an easy fashion.

Notifications You must be signed in to change notification settings

azerothcore/LibAzerothCore-1.0

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

LibAzerothCore-1.0

LibAzerothCore-1.0 is a library for the World of Warcraft client that integrates with the AzerothCore server software. It provides a Lua interface that allows addon code to interact with server commands in an easy fashion.

Supported branches

Branch as of commit
3.3.5 ebf5f67

API

LibAzerothCore::IsAzerothCore

isAzerothCore = LibStub("LibAzerothCore-1.0"):IsAzerothCore()

Returns true if the server is a supported AzerothCore build, false if not, and nil if testing is incomplete

LibAzerothCore::RegisterLoader

LibStub("LibAzerothCore-1.0"):RegisterLoader(callback)

Registers the passed callback to be called once AzerothCore detection finishes. This method might call your loader before returning, or asynchronously at any later point. Once the loader is called, IsAzerothCore() is guaranteed to return either true or false (never nil).

LibAzerothCore::DoCommand

LibStub("LibAzerothCore-1.0"):DoCommand(cmd, callback)

Invokes cmd on the server. Commands should be passed without leading command prefix (no . or !). When command execution finishes, callback will be invoked as callback(success, output). success is a boolean indicating whether the command's execution reported any errors, while output is an array of lines that the command printed.

Example usage

-- get library object - all calls are made through this object
local LibAzeroth = LibStub("LibAzerothCore-1.0")
assert(LibAzeroth)

-- define a command callback function
local function commandCallback(success, output)
  print("Command status: ", success and "OK" or "Fail")
  if #output > 0 then
    print("Command output:")
    for _,line in ipairs(output) do
      print(line)
    end
  else
    print("Command produced no output")
  end
end
  
-- then invoke the "server motd" and "server info" commands
LibAzeroth:DoCommand("server motd", commandCallback)
LibAzeroth:DoCommand("server info", commandCallback)

Credit

TrinityCore - LibTrinityCore-1.0

About

LibAzerothCore-1.0 is a library for the World of Warcraft client that integrates with the AzerothCore server software. It provides a Lua interface that allows addon code to interact with server commands in an easy fashion.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Lua 100.0%