org.luaj.vm2.lib.jse
Class JseOsLib

java.lang.Object
  extended by org.luaj.vm2.lib.OsLib
      extended by org.luaj.vm2.lib.jse.JseOsLib

public class JseOsLib
extends org.luaj.vm2.lib.OsLib

Subclass of LibFunction which implements the standard lua os library.

This contains more complete implementations of the following functions using features that are specific to JSE:

Because the nature of the os library is to encapsulate os-specific features, the behavior of these functions varies considerably from their counterparts in the C platform.

Typically, this library is included as part of a call to JsePlatform.standardGlobals()

 Globals globals = JsePlatform.standardGlobals();
 System.out.println( globals.get("os").get("time").call() );
  

For special cases where the smallest possible footprint is desired, a minimal set of libraries could be loaded directly via Globals#load(LuaValue) using code such as:

 Globals globals = new Globals();
 globals.load(new JseBaseLib());
 globals.load(new PackageLib());
 globals.load(new JseOsLib());
 System.out.println( globals.get("os").get("time").call() );
  

However, other libraries such as MathLib are not loaded in this case.

See Also:
LibFunction, OsLib, JsePlatform, org.luaj.vm2.lib.jme.JmePlatform, Lua 5.2 OS Lib Reference

Field Summary
static int EXEC_ERROR
          return code indicating the execute() threw an unknown exception
static int EXEC_INTERRUPTED
          return code indicating the execute() was interrupted
static int EXEC_IOEXCEPTION
          return code indicating the execute() threw an I/O exception
 
Constructor Summary
JseOsLib()
          public constructor
 
Method Summary
protected  Varargs execute(java.lang.String command)
           
protected  void remove(java.lang.String filename)
           
protected  void rename(java.lang.String oldname, java.lang.String newname)
           
protected  java.lang.String tmpname()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXEC_IOEXCEPTION

public static int EXEC_IOEXCEPTION
return code indicating the execute() threw an I/O exception


EXEC_INTERRUPTED

public static int EXEC_INTERRUPTED
return code indicating the execute() was interrupted


EXEC_ERROR

public static int EXEC_ERROR
return code indicating the execute() threw an unknown exception

Constructor Detail

JseOsLib

public JseOsLib()
public constructor

Method Detail

execute

protected Varargs execute(java.lang.String command)

remove

protected void remove(java.lang.String filename)
               throws java.io.IOException
Throws:
java.io.IOException

rename

protected void rename(java.lang.String oldname,
                      java.lang.String newname)
               throws java.io.IOException
Throws:
java.io.IOException

tmpname

protected java.lang.String tmpname()


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