This module provides two functions function that makes calling require() and mw.loadData() multiple easy.
Loading the module
To load this module and make its method available for use, Add this line of code to the start of your module:
require('Module:MultiRequire')
The described functions below will be able to be used as they are saved as global variables in the module this module was loaded in.
Alternatively, you can use this module using the code below by using Module:LoadLib.
local loadLib = require('Module:LoadLib')
_G = loadLib(_G, {
{ 'Module:MultiRequire' },
-- Place any other modules to load in here...
})
Depending on the settings you used in loadLib(), the methods of this module may be available under their respective variables in the module this module was loaded in.
Return Values
This module returns two functions:
- multiRequire() - Allows of loading of multiple modules at once.
- loadDataMulti() - Exactly the same as multiRequire(), but uses mw.loadData() instead of require().
multiRequire
multiRequire(<module 1/modules>(any), <module 2>(any), ...(any), <module N>(any))
Returns any values returned by require() are returned.
If the input is a table, it returns a table of the loaded modules. If variable length arguments are used, it returns the unpacked values.
It will throw an error if the module is not found or if there was an error in loading one of the requested modules.
Examples
multiRequire('Module:String')→<methods from Module:String>multiRequire{ 'Module:String', 'Module:Table' }→{ <methods from Module:String>, <methods from Module:Table> }
loadDataMulti
multiRequire(<module 1/modules>(any), <module 2>(any), ...(any), <module N>(any))
Works exactly the same as multiRequire(), but uses mw.loadData() instead internally.
Examples
multiRequire('Module:Pet/Data')→<data from Module:Pet/Data>multiRequire{ 'Module:UIText/Data', 'Module:Pet/Data' }→{ <data from Module:UIText/Data>, <data from Module:Pet/Data> }
Submodules
No submodules found for this page. Try purging the page or viewing all subpages.
See Also
| Hypixel SkyBlock Wiki Standard Lua Libraries (hsw/stdll) v · d · e | |
| Type | Libraries |
|---|---|
| Module Loading Utilities |
|
| General Utilities |
|
| Meta Modules | |
| Object-oriented |
|
| Caching | |