词条 | Module:Loader/doc |
释义 |
This metamodule helps with loading of another module. That module is loaded only after one of its functions is called for the first time. This prevents it from being recorded as used on a given page if none of its functions is actually called. {{TOC limit|2}}Usage 1local Loader = require('Module:Loader') -- Prefix 'Module:' is mandatory local MyModule = Loader.load('Module:MyModule') -- Prefix 'Module:' is optional Examplelocal Loader = require('Module:Loader') local Math = Loader.load('Math') return Math._random(10) In this case Math is loaded when Usage 2local load = require('Module:Loader').load -- Prefix 'Module:' is mandatory local myFunction = load('Module:MyModule', 'myFunction') -- Prefix 'Module:' is optional Examplelocal load = require('Module:Loader').load local random = load('Math', '_random') return random(10) In this case Math is loaded when }} 1 : Lua metamodules |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。