GithubHelp home page GithubHelp logo

libtrinitycore-1.0's Introduction

LibTrinityCore-1.0

LibTrinityCore-1.0 is a library for the World of Warcraft client that integrates with the TrinityCore 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 Notes
master 42c65c3 Supported serverside, lib needs updating with C_ChatInfo.RegisterAddonMessagePrefix("TrinityCore") on init
3.3.5 508c9d2

API

LibTrinityCore::IsTrinityCore

isTrinityCore = LibStub("LibTrinityCore-1.0"):IsTrinityCore()

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

LibTrinityCore::RegisterLoader

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

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

LibTrinityCore::DoCommand

LibStub("LibTrinityCore-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 LibTrinity = LibStub("LibTrinityCore-1.0")
assert(LibTrinity)

-- 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
LibTrinity:DoCommand("server motd", commandCallback)
LibTrinity:DoCommand("server info", commandCallback)

libtrinitycore-1.0's People

Contributors

rochet2 avatar shauren avatar treeston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.