User Tools

Site Tools


Common Library

The common library is a simple Lua file that just includes several popular and highly used libraries all in one.

The common library also exposes a useful switch statement implementation that addons can use to mimic switch case statements that are available in other languages.

An example of the switch case function:

function get_container_name(id)
    return switch(tostring(id)) : caseof
        ['0'] = function() return 'Inventory'; end
        ['1'] = function() return 'Mog Safe'; end,
        ['2'] = function() return 'Storage'; end,
        ['default'] = function() return nil; end,
-- This should print 'Mog Safe'..
addons/using_libs/common.txt · Last modified: 2015/11/18 22:37 by atom0s