commonlib.LibStub

LibStub is a simple versioning stub meant for use in Libraries

Title LibStub is a simple versioning stub meant for use in Libraries
Author(s) LiXizhi, The code is based on http://www.wowace.com/wiki/LibStub
Date 2008/5/9
File script/ide/LibStub.lua

Description

LibStub is a simple versioning stub meant for use in Libraries

TIP Sample Code

NPL.load("(gl)script/ide/LibStub.lua");

local libName = "YOUR_LIB_NAME";
local libVersion = "1.0";
local YOUR_LIB_NAME = commonlib.LibStub:NewLibrary(libName, libVersion);

-- optionally expose via a global name
CommonCtrl.YOUR_LIB_NAME = YOUR_LIB_NAME; 

Member Functions

commonlib.LibStub:NewLibrary

LibStub is a simple versioning stub meant for use in Libraries. commonlib.LibStub = commonlib.LibStub or {libs = {}, minors = {}};

commonlib.LibStub:NewLibrary(major, minor)

  • param major : (string) - the major version of the library
  • param minor : (number string or number) - the minor version of the library
  • return nil : if a newer or same version of the lib is already present returns empty library object or old library object if upgrade is needed

syntax

function commonlib.LibStub:NewLibrary(major, minor)

parameters

major (string) - the major version of the library
minor  
| return | if a newer or same version of the lib is already present returns empty library object or old library object if upgrade is needed |

commonlib.LibStub:GetLibrary

commonlib.LibStub:GetLibrary(major, [silent])

  • param major : (string) - the major version of the library
  • param silent : (boolean) - if true, library is optional, silently return nil if its not found throws an error if the library can not be found (except silent is set)

syntax

function commonlib.LibStub:GetLibrary(major, silent)

parameters

major (string) - the major version of the library
silent  

commonlib.LibStub:IterateLibraries

commonlib.LibStub:IterateLibraries()

  • return an : iterator for the currently registered libraries

syntax

function commonlib.LibStub:IterateLibraries() 

parameters

return iterator for the currently registered libraries
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback