org.luaj.vm2.server
Class DefaultLauncher

java.lang.Object
  extended by org.luaj.vm2.server.DefaultLauncher
All Implemented Interfaces:
Launcher

public class DefaultLauncher
extends java.lang.Object
implements Launcher

Default Launcher instance that creates standard globals and runs the supplied scripts with chunk name 'main'.

Arguments are coerced into lua using CoerceJavaToLua.coerce(Object).

Return values with simple types are coerced into Java simple types. Tables, threads, and functions are returned as lua objects.

Since:
luaj 3.0.1
See Also:
Launcher, LuajClassLoader, LuajClassLoader.NewLauncher(), LuajClassLoader.NewLauncher(Class)

Field Summary
protected  Globals g
           
 
Constructor Summary
DefaultLauncher()
           
 
Method Summary
 java.lang.Object[] launch(java.io.InputStream script, java.lang.Object[] arg)
          Launches the script with chunk name 'main' and loading using modes 'bt'
 java.lang.Object[] launch(java.io.Reader script, java.lang.Object[] arg)
          Launches the script with chunk name 'main'
 java.lang.Object[] launch(java.lang.String script, java.lang.Object[] arg)
          Launches the script with chunk name 'main'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g

protected Globals g
Constructor Detail

DefaultLauncher

public DefaultLauncher()
Method Detail

launch

public java.lang.Object[] launch(java.lang.String script,
                                 java.lang.Object[] arg)
Launches the script with chunk name 'main'

Specified by:
launch in interface Launcher
Parameters:
script - The script contents.
arg - Optional arguments supplied to the script.
Returns:
return values from the script.

launch

public java.lang.Object[] launch(java.io.InputStream script,
                                 java.lang.Object[] arg)
Launches the script with chunk name 'main' and loading using modes 'bt'

Specified by:
launch in interface Launcher
Parameters:
script - The script as an InputStream.
arg - Optional arguments supplied to the script.
Returns:
return values from the script.

launch

public java.lang.Object[] launch(java.io.Reader script,
                                 java.lang.Object[] arg)
Launches the script with chunk name 'main'

Specified by:
launch in interface Launcher
Parameters:
script - The script as a Reader.
arg - Optional arguments supplied to the script.
Returns:
return values from the script.


Copyright © 2007-2015 Luaj.org. All Rights Reserved.