public class StandardLibrary extends Object
This is an immutable class that provides transformation methods for manipulating
the configuration, and the installInto(StateContext) method for installing
the standard library with the specified configuration into a Lua state.
| Modifier and Type | Method and Description |
|---|---|
static StandardLibrary |
in(RuntimeEnvironment environment)
Returns a default configuration for the specified environment.
|
org.classdump.luna.Table |
installInto(org.classdump.luna.StateContext state)
Installs the standard library into
state, returning a new table suitable
for use as the global upvalue. |
StandardLibrary |
withDebug(boolean hasDebug)
Returns a configuration that includes the Debug library iff
hasDebug
is true. |
StandardLibrary |
withLoader(org.classdump.luna.load.ChunkLoader chunkLoader)
Returns a configuration that differs from this configuration in that
it uses the chunk loader
chunkLoader. |
StandardLibrary |
withModuleLoader(ClassLoader moduleLoader)
Returns a configuration that differs from this configuration in that
it uses the module loader
moduleLoader. |
public static StandardLibrary in(RuntimeEnvironment environment)
If any of the standard streams defined by the runtime environment is null,
the corresponding file in the I/O library (such as io.stdin) will be undefined.
Additionally, if out is null, then the global function print
will be undefined.
environment - the runtime environment, must not be nullNullPointerException - if environment is nullpublic StandardLibrary withLoader(org.classdump.luna.load.ChunkLoader chunkLoader)
chunkLoader. If chunkLoader is null,
no chunk loader is used.chunkLoader - the chunk loader, may be nullloader as its chunk loaderpublic StandardLibrary withModuleLoader(ClassLoader moduleLoader)
moduleLoader. If moduleLoader is null,
no module loader is used.moduleLoader - the chunk loader, may be nullloader as its chunk loaderpublic StandardLibrary withDebug(boolean hasDebug)
hasDebug
is true.hasDebug - boolean flag indicating whether to include the Debug libraryhasDebug is
truepublic org.classdump.luna.Table installInto(org.classdump.luna.StateContext state)
state, returning a new table suitable
for use as the global upvalue.
The returned table is instantiated using the table factory provided by state.
state - the Lua state context to install into, must not be nullNullPointerException - if state is nullCopyright © 2016–2017. All rights reserved.