---++!! !commonlib.LibStub %TOC{title="Contents:"}% %STARTINCLUDE% ---++ 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 %T% __Sample Code__ <verbatim> 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; </verbatim> ---+++ 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__ <verbatim>function commonlib.LibStub:NewLibrary(major, minor)</verbatim> __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__ <verbatim>function commonlib.LibStub:GetLibrary(major, silent)</verbatim> __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__ <verbatim>function commonlib.LibStub:IterateLibraries() </verbatim> __parameters__ | *return* | iterator for the currently registered libraries | %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 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