Added missed Classes

This commit is contained in:
UnlegitDqrk
2026-03-01 12:56:55 +01:00
parent f087e87806
commit 405fd633fd
58 changed files with 134 additions and 156 deletions

View File

@@ -254,7 +254,7 @@ A simple hello, world example in luaj is:
<pre> <pre>
import org.luaj.vm2.*; import org.luaj.vm2.*;
import org.luaj.vm2.lib.jse.*; import org.luaj.vm2.libs.jse.*;
Globals globals = JsePlatform.standardGlobals(); Globals globals = JsePlatform.standardGlobals();
LuaValue chunk = globals.load("print 'hello, world'"); LuaValue chunk = globals.load("print 'hello, world'");
@@ -296,7 +296,7 @@ For MIDlets the <em>JmePlatform</em> is used instead:
<pre> <pre>
import org.luaj.vm2.*; import org.luaj.vm2.*;
import org.luaj.vm2.lib.jme.*; import org.luaj.vm2.libs.jme.*;
Globals globals = JmePlatform.standardGlobals(); Globals globals = JmePlatform.standardGlobals();
LuaValue chunk = globals.loadfile("examples/lua/hello.lua"); LuaValue chunk = globals.loadfile("examples/lua/hello.lua");
@@ -566,7 +566,7 @@ create globals that contain the debug library in addition to the other standard
To install dynamically from lua use java-class-based require:</em>: To install dynamically from lua use java-class-based require:</em>:
<pre> <pre>
require 'org.luaj.vm2.lib.DebugLib' require 'org.luaj.vm2.libs.DebugLib'
</pre> </pre>
The <em>lua</em> command line utility includes the <em>debug</em> library by default. The <em>lua</em> command line utility includes the <em>debug</em> library by default.
@@ -666,11 +666,11 @@ The simplest way to implement a function is to choose a base class based on the
LuaJ provides 5 base classes for this purpose, depending if the function has 0, 1, 2, 3 or variable arguments, LuaJ provides 5 base classes for this purpose, depending if the function has 0, 1, 2, 3 or variable arguments,
and if it provide multiple return values. and if it provide multiple return values.
<pre> <pre>
<a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/ZeroArgFunction.html">org.luaj.vm2.lib.ZeroArgFunction</a> <a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/ZeroArgFunction.html">org.luaj.vm2.libs.ZeroArgFunction</a>
<a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/OneArgFunction.html">org.luaj.vm2.lib.OneArgFunction</a> <a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/OneArgFunction.html">org.luaj.vm2.libs.OneArgFunction</a>
<a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/TwoArgFunction.html">org.luaj.vm2.lib.TwoArgFunction</a> <a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/TwoArgFunction.html">org.luaj.vm2.libs.TwoArgFunction</a>
<a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/ThreeArgFunction.html">org.luaj.vm2.lib.ThreeArgFunction</a> <a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/ThreeArgFunction.html">org.luaj.vm2.libs.ThreeArgFunction</a>
<a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/VarArgFunction.html">org.luaj.vm2.lib.VarArgFunction</a> <a href="http://luaj.org/luaj/3.0/api/org/luaj/vm2/lib/VarArgFunction.html">org.luaj.vm2.libs.VarArgFunction</a>
</pre> </pre>
Each of these functions has an abstract method that must be implemented, Each of these functions has an abstract method that must be implemented,
@@ -724,7 +724,7 @@ in the environment that can be called from lua.
A complete example of Java code for a simple toy library is in <a href="examples/jse/hyperbolic.java">examples/jse/hyperbolic.java</a> A complete example of Java code for a simple toy library is in <a href="examples/jse/hyperbolic.java">examples/jse/hyperbolic.java</a>
<pre> <pre>
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.*; import org.luaj.vm2.libs.*;
public class hyperbolic extends TwoArgFunction { public class hyperbolic extends TwoArgFunction {

View File

@@ -26,11 +26,11 @@ import java.io.InputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.Reader; import java.io.Reader;
import org.luaj.vm2.lib.BaseLib; import org.luaj.vm2.libs.BaseLib;
import org.luaj.vm2.lib.DebugLib; import org.luaj.vm2.libs.DebugLib;
import org.luaj.vm2.lib.IoLib; import org.luaj.vm2.libs.IoLib;
import org.luaj.vm2.lib.PackageLib; import org.luaj.vm2.libs.PackageLib;
import org.luaj.vm2.lib.ResourceFinder; import org.luaj.vm2.libs.ResourceFinder;
/** /**
* Global environment used by luaj. Contains global variables referenced by executing lua. * Global environment used by luaj. Contains global variables referenced by executing lua.
@@ -38,8 +38,8 @@ import org.luaj.vm2.lib.ResourceFinder;
* *
* <h3>Constructing and Initializing Instances</h3> * <h3>Constructing and Initializing Instances</h3>
* Typically, this is constructed indirectly by a call to * Typically, this is constructed indirectly by a call to
* {@link org.luaj.vm2.lib.jse.JsePlatform#standardGlobals()} or * {@link org.luaj.vm2.libs.jse.JsePlatform#standardGlobals()} or
* {@link org.luaj.vm2.lib.jme.JmePlatform#standardGlobals()}, * {@link org.luaj.vm2.libs.jme.JmePlatform#standardGlobals()},
* and then used to load lua scripts for execution as in the following example. * and then used to load lua scripts for execution as in the following example.
* <pre> {@code * <pre> {@code
* Globals globals = JsePlatform.standardGlobals(); * Globals globals = JsePlatform.standardGlobals();
@@ -89,7 +89,7 @@ import org.luaj.vm2.lib.ResourceFinder;
* </ul> * </ul>
* *
* <h3>Lua Environment Variables</h3> * <h3>Lua Environment Variables</h3>
* When using {@link org.luaj.vm2.lib.jse.JsePlatform} or {@link org.luaj.vm2.lib.jme.JmePlatform}, * When using {@link org.luaj.vm2.libs.jse.JsePlatform} or {@link org.luaj.vm2.libs.jme.JmePlatform},
* these environment variables are created within the Globals. * these environment variables are created within the Globals.
* <ul> * <ul>
* <li>"_G" Pointer to this Globals. * <li>"_G" Pointer to this Globals.
@@ -102,8 +102,8 @@ import org.luaj.vm2.lib.ResourceFinder;
* static immutable resources such as class data and string data. * static immutable resources such as class data and string data.
* <p> * <p>
* *
* @see org.luaj.vm2.lib.jse.JsePlatform * @see org.luaj.vm2.libs.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform * @see org.luaj.vm2.libs.jme.JmePlatform
* @see LuaValue * @see LuaValue
* @see Compiler * @see Compiler
* @see Loader * @see Loader

View File

@@ -44,8 +44,8 @@ import java.io.InputStream;
* This should work regardless of which {@link Globals.Compiler} or {@link Globals.Undumper} * This should work regardless of which {@link Globals.Compiler} or {@link Globals.Undumper}
* have been installed. * have been installed.
* <p> * <p>
* By default, when using {@link org.luaj.vm2.lib.jse.JsePlatform} or * By default, when using {@link org.luaj.vm2.libs.jse.JsePlatform} or
* {@link org.luaj.vm2.lib.jme.JmePlatform} * {@link org.luaj.vm2.libs.jme.JmePlatform}
* to construct globals, the {@link LoadState} default undumper is installed * to construct globals, the {@link LoadState} default undumper is installed
* as the default {@link Globals.Undumper}. * as the default {@link Globals.Undumper}.
* <p> * <p>

View File

@@ -21,7 +21,7 @@
******************************************************************************/ ******************************************************************************/
package org.luaj.vm2; package org.luaj.vm2;
import org.luaj.vm2.lib.DebugLib.CallFrame; import org.luaj.vm2.libs.DebugLib.CallFrame;
/** /**
* Extension of {@link LuaFunction} which executes lua bytecode. * Extension of {@link LuaFunction} which executes lua bytecode.

View File

@@ -21,7 +21,7 @@
******************************************************************************/ ******************************************************************************/
package org.luaj.vm2; package org.luaj.vm2;
import org.luaj.vm2.lib.MathLib; import org.luaj.vm2.libs.MathLib;
/** /**
* Extension of {@link LuaNumber} which can hold a Java double as its value. * Extension of {@link LuaNumber} which can hold a Java double as its value.

View File

@@ -25,14 +25,14 @@ package org.luaj.vm2;
/** /**
* Base class for functions implemented in Java. * Base class for functions implemented in Java.
* <p> * <p>
* Direct subclass include {@link org.luaj.vm2.lib.LibFunction} * Direct subclass include {@link org.luaj.vm2.libs.LibFunction}
* which is the base class for * which is the base class for
* all built-in library functions coded in Java, * all built-in library functions coded in Java,
* and {@link LuaClosure}, which represents a lua closure * and {@link LuaClosure}, which represents a lua closure
* whose bytecode is interpreted when the function is invoked. * whose bytecode is interpreted when the function is invoked.
* @see LuaValue * @see LuaValue
* @see LuaClosure * @see LuaClosure
* @see org.luaj.vm2.lib.LibFunction * @see org.luaj.vm2.libs.LibFunction
*/ */
abstract abstract
public class LuaFunction extends LuaValue { public class LuaFunction extends LuaValue {

View File

@@ -21,7 +21,7 @@
******************************************************************************/ ******************************************************************************/
package org.luaj.vm2; package org.luaj.vm2;
import org.luaj.vm2.lib.MathLib; import org.luaj.vm2.libs.MathLib;
/** /**
* Extension of {@link LuaNumber} which can hold a Java int as its value. * Extension of {@link LuaNumber} which can hold a Java int as its value.

View File

@@ -28,7 +28,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintStream; import java.io.PrintStream;
import org.luaj.vm2.lib.MathLib; import org.luaj.vm2.libs.MathLib;
/** /**
* Subclass of {@link LuaValue} for representing lua strings. * Subclass of {@link LuaValue} for representing lua strings.

View File

@@ -40,8 +40,8 @@ import java.util.concurrent.locks.ReentrantLock;
* This is done via the constructor arguments {@link #LuaThread(Globals)} or * This is done via the constructor arguments {@link #LuaThread(Globals)} or
* {@link #LuaThread(Globals, LuaValue)}. * {@link #LuaThread(Globals, LuaValue)}.
* <p> * <p>
* The utility classes {@link org.luaj.vm2.lib.jse.JsePlatform} and * The utility classes {@link org.luaj.vm2.libs.jse.JsePlatform} and
* {@link org.luaj.vm2.lib.jme.JmePlatform} * {@link org.luaj.vm2.libs.jme.JmePlatform}
* see to it that this {@link Globals} are initialized properly. * see to it that this {@link Globals} are initialized properly.
* <p> * <p>
* The behavior of coroutine threads matches closely the behavior * The behavior of coroutine threads matches closely the behavior
@@ -65,9 +65,9 @@ import java.util.concurrent.locks.ReentrantLock;
* *
* *
* @see LuaValue * @see LuaValue
* @see org.luaj.vm2.lib.jse.JsePlatform * @see org.luaj.vm2.libs.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform * @see org.luaj.vm2.libs.jme.JmePlatform
* @see org.luaj.vm2.lib.CoroutineLib * @see org.luaj.vm2.libs.CoroutineLib
*/ */
public class LuaThread extends LuaValue { public class LuaThread extends LuaValue {

View File

@@ -75,7 +75,7 @@ package org.luaj.vm2;
* } </pre> * } </pre>
* For this to work the file must be in the current directory, or in the class path, * For this to work the file must be in the current directory, or in the class path,
* dependening on the platform. * dependening on the platform.
* See {@link org.luaj.vm2.lib.jse.JsePlatform} and {@link org.luaj.vm2.lib.jme.JmePlatform} for details. * See {@link org.luaj.vm2.libs.jse.JsePlatform} and {@link org.luaj.vm2.libs.jme.JmePlatform} for details.
* <p> * <p>
* In general a {@link LuaError} may be thrown on any operation when the * In general a {@link LuaError} may be thrown on any operation when the
* types supplied to any operation are illegal from a lua perspective. * types supplied to any operation are illegal from a lua perspective.
@@ -101,8 +101,8 @@ package org.luaj.vm2;
* {@link #MOD}, {@link #UNM}, {@link #LEN}, {@link #EQ}, {@link #LT}, * {@link #MOD}, {@link #UNM}, {@link #LEN}, {@link #EQ}, {@link #LT},
* {@link #LE}, {@link #TOSTRING}, and {@link #CONCAT}. * {@link #LE}, {@link #TOSTRING}, and {@link #CONCAT}.
* *
* @see org.luaj.vm2.lib.jse.JsePlatform * @see org.luaj.vm2.libs.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform * @see org.luaj.vm2.libs.jme.JmePlatform
* @see LoadState * @see LoadState
* @see Varargs * @see Varargs
*/ */

View File

@@ -33,7 +33,7 @@ import org.luaj.vm2.LuaString;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.compiler.FuncState.BlockCnt; import org.luaj.vm2.compiler.FuncState.BlockCnt;
import org.luaj.vm2.lib.MathLib; import org.luaj.vm2.libs.MathLib;
public class LexState extends Constants { public class LexState extends Constants {

View File

@@ -31,7 +31,7 @@ import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaString; import org.luaj.vm2.LuaString;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.lib.BaseLib; import org.luaj.vm2.libs.BaseLib;
/** /**
* Compiler for Lua. * Compiler for Lua.
@@ -49,7 +49,7 @@ import org.luaj.vm2.lib.BaseLib;
* *
* <p> * <p>
* The {@link LuaC} compiler is installed by default by both the * The {@link LuaC} compiler is installed by default by both the
* {@link org.luaj.vm2.lib.jse.JsePlatform} and {@link org.luaj.vm2.lib.jme.JmePlatform} classes, * {@link org.luaj.vm2.libs.jse.JsePlatform} and {@link org.luaj.vm2.libs.jme.JmePlatform} classes,
* so in the following example, the default {@link LuaC} compiler * so in the following example, the default {@link LuaC} compiler
* will be used: * will be used:
* <pre> {@code * <pre> {@code
@@ -66,8 +66,8 @@ import org.luaj.vm2.lib.BaseLib;
* @see Globals#compiler * @see Globals#compiler
* @see Globals#loader * @see Globals#loader
* @see org.luaj.vm2.luajc.LuaJC * @see org.luaj.vm2.luajc.LuaJC
* @see org.luaj.vm2.lib.jse.JsePlatform * @see org.luaj.vm2.libs.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform * @see org.luaj.vm2.libs.jme.JmePlatform
* @see BaseLib * @see BaseLib
* @see LuaValue * @see LuaValue
* @see Prototype * @see Prototype

View File

@@ -1,7 +1,7 @@
package org.luaj.vm2.android; package org.luaj.vm2.android;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.CoerceJavaToLua; import org.luaj.vm2.libs.jse.CoerceJavaToLua;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;

View File

@@ -4,9 +4,9 @@ import java.io.InputStream;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.ResourceFinder; import org.luaj.vm2.libs.ResourceFinder;
import org.luaj.vm2.lib.jse.CoerceJavaToLua; import org.luaj.vm2.libs.jse.CoerceJavaToLua;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;

View File

@@ -4,7 +4,7 @@ import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException; import javax.microedition.midlet.MIDletStateChangeException;
import org.luaj.vm2.*; import org.luaj.vm2.*;
import org.luaj.vm2.lib.jme.JmePlatform; import org.luaj.vm2.libs.jme.JmePlatform;
public class SampleMIDlet extends MIDlet { public class SampleMIDlet extends MIDlet {

View File

@@ -1,7 +1,7 @@
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaThread; import org.luaj.vm2.LuaThread;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** Example that continually launches coroutines, and illustrates how to make /** Example that continually launches coroutines, and illustrates how to make
* sure the orphaned coroutines are cleaned up properly. * sure the orphaned coroutines are cleaned up properly.

View File

@@ -7,18 +7,18 @@ import org.luaj.vm2.Globals;
import org.luaj.vm2.LoadState; import org.luaj.vm2.LoadState;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.compiler.LuaC; import org.luaj.vm2.compiler.LuaC;
import org.luaj.vm2.lib.Bit32Lib; import org.luaj.vm2.libs.Bit32Lib;
import org.luaj.vm2.lib.CoroutineLib; import org.luaj.vm2.libs.CoroutineLib;
import org.luaj.vm2.lib.PackageLib; import org.luaj.vm2.libs.PackageLib;
import org.luaj.vm2.lib.ResourceFinder; import org.luaj.vm2.libs.ResourceFinder;
import org.luaj.vm2.lib.TableLib; import org.luaj.vm2.libs.TableLib;
import org.luaj.vm2.lib.jse.CoerceJavaToLua; import org.luaj.vm2.libs.jse.CoerceJavaToLua;
import org.luaj.vm2.lib.jse.JseBaseLib; import org.luaj.vm2.libs.jse.JseBaseLib;
import org.luaj.vm2.lib.jse.JseIoLib; import org.luaj.vm2.libs.jse.JseIoLib;
import org.luaj.vm2.lib.jse.JseMathLib; import org.luaj.vm2.libs.jse.JseMathLib;
import org.luaj.vm2.lib.jse.JseOsLib; import org.luaj.vm2.libs.jse.JseOsLib;
import org.luaj.vm2.lib.jse.JseStringLib; import org.luaj.vm2.libs.jse.JseStringLib;
import org.luaj.vm2.lib.jse.LuajavaLib; import org.luaj.vm2.libs.jse.LuajavaLib;
/** /**
* Simple Applet that forwards Applet lifecycle events to a lua script. * Simple Applet that forwards Applet lifecycle events to a lua script.

View File

@@ -1,7 +1,7 @@
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** Simple program showing the minimal Java program to launch a script. /** Simple program showing the minimal Java program to launch a script.
* *

View File

@@ -1,7 +1,7 @@
import java.io.IOException; import java.io.IOException;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** Simple toy program illustrating how to run Luaj in multiple threads. /** Simple toy program illustrating how to run Luaj in multiple threads.
* *

View File

@@ -7,15 +7,15 @@ import org.luaj.vm2.LuaThread;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.compiler.LuaC; import org.luaj.vm2.compiler.LuaC;
import org.luaj.vm2.lib.Bit32Lib; import org.luaj.vm2.libs.Bit32Lib;
import org.luaj.vm2.lib.DebugLib; import org.luaj.vm2.libs.DebugLib;
import org.luaj.vm2.lib.PackageLib; import org.luaj.vm2.libs.PackageLib;
import org.luaj.vm2.lib.TableLib; import org.luaj.vm2.libs.TableLib;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
import org.luaj.vm2.lib.jse.JseBaseLib; import org.luaj.vm2.libs.jse.JseBaseLib;
import org.luaj.vm2.lib.jse.JseMathLib; import org.luaj.vm2.libs.jse.JseMathLib;
import org.luaj.vm2.lib.jse.JseStringLib; import org.luaj.vm2.libs.jse.JseStringLib;
/** Simple program that illustrates basic sand-boxing of client scripts /** Simple program that illustrates basic sand-boxing of client scripts
* in a server environment. * in a server environment.

View File

@@ -3,7 +3,7 @@ import java.io.Reader;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.server.Launcher; import org.luaj.vm2.server.Launcher;
import org.luaj.vm2.server.LuajClassLoader; import org.luaj.vm2.server.LuajClassLoader;

View File

@@ -12,7 +12,7 @@ import javax.script.ScriptException;
import javax.script.SimpleBindings; import javax.script.SimpleBindings;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.OneArgFunction; import org.luaj.vm2.libs.OneArgFunction;
/** Sample code that uses the JSE-223 pluggable scripting language interface /** Sample code that uses the JSE-223 pluggable scripting language interface
* to instantiate and use luaj. * to instantiate and use luaj.

View File

@@ -1,6 +1,6 @@
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.OneArgFunction; import org.luaj.vm2.libs.OneArgFunction;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
/** /**
* Sample library that can be called via luaj's require() implementation. * Sample library that can be called via luaj's require() implementation.

View File

@@ -2,7 +2,7 @@ package acme;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** /**
* Sample source file for a maven project that depends on luaj. * Sample source file for a maven project that depends on luaj.

View File

@@ -10,9 +10,7 @@ import junit.framework.TestSuite;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import acme.App;
/** /**
* Skeleton unit test for App, required for maven to be used to build the app. * Skeleton unit test for App, required for maven to be used to build the app.

View File

@@ -1,17 +0,0 @@
package org.openautonomousconnection.luaj;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
static void main() {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
IO.println(String.format("Hello and welcome!"));
for (int i = 1; i <= 5; i++) {
//TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
IO.println("i = " + i);
}
}
}

View File

@@ -35,7 +35,7 @@ import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Print; import org.luaj.vm2.Print;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;

View File

@@ -33,7 +33,7 @@ import org.luaj.vm2.Lua;
import org.luaj.vm2.Print; import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.compiler.DumpState; import org.luaj.vm2.compiler.DumpState;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** /**

View File

@@ -32,7 +32,7 @@ import java.util.List;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.Lua; import org.luaj.vm2.Lua;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;
/** /**

View File

@@ -60,11 +60,11 @@ import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.OneArgFunction; import org.luaj.vm2.libs.OneArgFunction;
import org.luaj.vm2.lib.ThreeArgFunction; import org.luaj.vm2.libs.ThreeArgFunction;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.lib.VarArgFunction; import org.luaj.vm2.libs.VarArgFunction;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
public class JavaBuilder { public class JavaBuilder {

View File

@@ -32,13 +32,14 @@ import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.compiler.LuaC; import org.luaj.vm2.compiler.LuaC;
import org.luaj.vm2.libs.jse.JsePlatform;
/** /**
* Implementation of {@link Globals.Compiler} which does direct * Implementation of {@link Globals.Compiler} which does direct
* lua-to-java-bytecode compiling. * lua-to-java-bytecode compiling.
* <p> * <p>
* By default, when using {@link org.luaj.vm2.lib.jse.JsePlatform} or * By default, when using {@link JsePlatform} or
* {@link org.luaj.vm2.lib.jme.JmePlatform} * {@link org.luaj.vm2.libs.jme.JmePlatform}
* to construct globals, the plain compiler {@link LuaC} is installed and lua code * to construct globals, the plain compiler {@link LuaC} is installed and lua code
* will only be compiled into lua bytecode and execute as {@link LuaClosure}. * will only be compiled into lua bytecode and execute as {@link LuaClosure}.
* <p> * <p>

View File

@@ -26,9 +26,9 @@ import java.io.*;
import javax.script.*; import javax.script.*;
import org.luaj.vm2.*; import org.luaj.vm2.*;
import org.luaj.vm2.lib.ThreeArgFunction; import org.luaj.vm2.libs.ThreeArgFunction;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.lib.jse.CoerceJavaToLua; import org.luaj.vm2.libs.jse.CoerceJavaToLua;
/** /**
* Implementation of the ScriptEngine interface which can compile and execute * Implementation of the ScriptEngine interface which can compile and execute

View File

@@ -32,7 +32,7 @@ import javax.script.ScriptContext;
import javax.script.SimpleScriptContext; import javax.script.SimpleScriptContext;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;
/** /**

View File

@@ -27,8 +27,8 @@ import java.io.Reader;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.jse.CoerceJavaToLua; import org.luaj.vm2.libs.jse.CoerceJavaToLua;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** /**
* Default {@link Launcher} instance that creates standard globals * Default {@link Launcher} instance that creates standard globals

View File

@@ -2,8 +2,8 @@ package org.luaj.luajc;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.lib.VarArgFunction; import org.luaj.vm2.libs.VarArgFunction;
public class SampleMainChunk extends VarArgFunction { public class SampleMainChunk extends VarArgFunction {

View File

@@ -25,7 +25,7 @@ import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Print; import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
/** Test the plain old bytecode interpreter */ /** Test the plain old bytecode interpreter */
public class TestLuaJ { public class TestLuaJ {

View File

@@ -31,7 +31,7 @@ import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Print; import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.Varargs; import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;
public class TestLuaJC { public class TestLuaJC {

View File

@@ -32,11 +32,11 @@ import org.luaj.vm2.compiler.DumpLoadEndianIntTest;
import org.luaj.vm2.compiler.LuaParserTests; import org.luaj.vm2.compiler.LuaParserTests;
import org.luaj.vm2.compiler.RegressionTests; import org.luaj.vm2.compiler.RegressionTests;
import org.luaj.vm2.compiler.SimpleTests; import org.luaj.vm2.compiler.SimpleTests;
import org.luaj.vm2.lib.jse.JsePlatformTest; import org.luaj.vm2.libs.jse.JsePlatformTest;
import org.luaj.vm2.lib.jse.LuaJavaCoercionTest; import org.luaj.vm2.libs.jse.LuaJavaCoercionTest;
import org.luaj.vm2.lib.jse.LuajavaAccessibleMembersTest; import org.luaj.vm2.libs.jse.LuajavaAccessibleMembersTest;
import org.luaj.vm2.lib.jse.LuajavaClassMembersTest; import org.luaj.vm2.libs.jse.LuajavaClassMembersTest;
import org.luaj.vm2.lib.jse.OsLibTest; import org.luaj.vm2.libs.jse.OsLibTest;
import org.luaj.vm2.script.ScriptEngineTests; import org.luaj.vm2.script.ScriptEngineTests;
public class AllTests { public class AllTests {

View File

@@ -27,7 +27,7 @@ import java.io.StringReader;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;
/** /**

View File

@@ -26,7 +26,7 @@ import java.io.Reader;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.server.Launcher; import org.luaj.vm2.server.Launcher;
import org.luaj.vm2.server.LuajClassLoader; import org.luaj.vm2.server.LuajClassLoader;

View File

@@ -28,8 +28,8 @@ import java.lang.reflect.InvocationTargetException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.TypeTest.MyData; import org.luaj.vm2.TypeTest.MyData;
import org.luaj.vm2.compiler.LuaC; import org.luaj.vm2.libs.ZeroArgFunction;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.jse.JsePlatform;
public class LuaOperationsTest extends TestCase { public class LuaOperationsTest extends TestCase {
@@ -130,7 +130,7 @@ public class LuaOperationsTest extends TestCase {
public Prototype createPrototype( String script, String name ) { public Prototype createPrototype( String script, String name ) {
try { try {
Globals globals = org.luaj.vm2.lib.jse.JsePlatform.standardGlobals(); Globals globals = JsePlatform.standardGlobals();
Reader reader = new StringReader(script); Reader reader = new StringReader(script);
return globals.compilePrototype(reader, name); return globals.compilePrototype(reader, name);
} catch (Exception e) { } catch (Exception e) {
@@ -146,7 +146,7 @@ public class LuaOperationsTest extends TestCase {
// set up suitable environments for execution // set up suitable environments for execution
LuaValue aaa = LuaValue.valueOf("aaa"); LuaValue aaa = LuaValue.valueOf("aaa");
LuaValue eee = LuaValue.valueOf("eee"); LuaValue eee = LuaValue.valueOf("eee");
final Globals globals = org.luaj.vm2.lib.jse.JsePlatform.standardGlobals(); final Globals globals = JsePlatform.standardGlobals();
LuaTable newenv = LuaValue.tableOf( new LuaValue[] { LuaTable newenv = LuaValue.tableOf( new LuaValue[] {
LuaValue.valueOf("a"), LuaValue.valueOf("aaa"), LuaValue.valueOf("a"), LuaValue.valueOf("aaa"),
LuaValue.valueOf("b"), LuaValue.valueOf("bbb"), } ); LuaValue.valueOf("b"), LuaValue.valueOf("bbb"), } );

View File

@@ -2,8 +2,8 @@ package org.luaj.vm2;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.jme.JmePlatform; import org.luaj.vm2.libs.jme.JmePlatform;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class MathLibTest extends TestCase { public class MathLibTest extends TestCase {

View File

@@ -24,10 +24,10 @@ package org.luaj.vm2;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.TypeTest.MyData; import org.luaj.vm2.TypeTest.MyData;
import org.luaj.vm2.lib.StringLib; import org.luaj.vm2.libs.StringLib;
import org.luaj.vm2.lib.ThreeArgFunction; import org.luaj.vm2.libs.ThreeArgFunction;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
public class MetatableTest extends TestCase { public class MetatableTest extends TestCase {

View File

@@ -25,8 +25,8 @@ import java.lang.ref.WeakReference;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.OneArgFunction; import org.luaj.vm2.libs.OneArgFunction;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class OrphanedThreadTest extends TestCase { public class OrphanedThreadTest extends TestCase {

View File

@@ -2,7 +2,7 @@ package org.luaj.vm2;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.require.RequireSampleClassCastExcep; import org.luaj.vm2.require.RequireSampleClassCastExcep;
import org.luaj.vm2.require.RequireSampleLoadLuaError; import org.luaj.vm2.require.RequireSampleLoadLuaError;
import org.luaj.vm2.require.RequireSampleLoadRuntimeExcep; import org.luaj.vm2.require.RequireSampleLoadRuntimeExcep;

View File

@@ -34,8 +34,9 @@ import java.net.URL;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.ResourceFinder; import org.luaj.vm2.libs.ResourceFinder;
import org.luaj.vm2.lib.jse.JseProcess; import org.luaj.vm2.libs.jse.JseProcess;
import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.luajc.LuaJC; import org.luaj.vm2.luajc.LuaJC;
abstract abstract
@@ -64,10 +65,10 @@ public class ScriptDrivenTest extends TestCase implements ResourceFinder {
default: default:
case JSE: case JSE:
case LUAJIT: case LUAJIT:
globals = org.luaj.vm2.lib.jse.JsePlatform.debugGlobals(); globals = JsePlatform.debugGlobals();
break; break;
case JME: case JME:
globals = org.luaj.vm2.lib.jme.JmePlatform.debugGlobals(); globals = org.luaj.vm2.libs.jme.JmePlatform.debugGlobals();
break; break;
} }
} }

View File

@@ -6,7 +6,7 @@ import java.io.UnsupportedEncodingException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class StringTest extends TestCase { public class StringTest extends TestCase {

View File

@@ -23,10 +23,7 @@ package org.luaj.vm2;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.LuaString; import org.luaj.vm2.libs.TwoArgFunction;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.TwoArgFunction;
/** /**
* Tests for tables used as lists. * Tests for tables used as lists.

View File

@@ -25,8 +25,8 @@ import java.lang.reflect.InvocationTargetException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class TypeTest extends TestCase { public class TypeTest extends TestCase {
static { static {

View File

@@ -23,7 +23,7 @@ package org.luaj.vm2;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class UTF8StreamTest extends TestCase { public class UTF8StreamTest extends TestCase {

View File

@@ -25,7 +25,7 @@ import java.lang.reflect.InvocationTargetException;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
/** /**
* Tests of basic unary and binary operators on main value types. * Tests of basic unary and binary operators on main value types.

View File

@@ -4,8 +4,7 @@ import junit.framework.TestCase;
import org.luaj.vm2.Globals; import org.luaj.vm2.Globals;
import org.luaj.vm2.Print; import org.luaj.vm2.Print;
import org.luaj.vm2.Prototype; import org.luaj.vm2.Prototype;
import org.luaj.vm2.compiler.DumpState; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.lib.jse.JsePlatform;
import java.io.*; import java.io.*;
import java.net.MalformedURLException; import java.net.MalformedURLException;

View File

@@ -2,8 +2,7 @@ package org.luaj.vm2.compiler;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.luaj.vm2.*; import org.luaj.vm2.*;
import org.luaj.vm2.compiler.DumpState; import org.luaj.vm2.libs.jse.JsePlatform;
import org.luaj.vm2.lib.jse.JsePlatform;
import java.io.*; import java.io.*;

View File

@@ -5,7 +5,7 @@ import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaDouble; import org.luaj.vm2.LuaDouble;
import org.luaj.vm2.LuaInteger; import org.luaj.vm2.LuaInteger;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.jse.JsePlatform; import org.luaj.vm2.libs.jse.JsePlatform;
public class SimpleTests extends TestCase { public class SimpleTests extends TestCase {

View File

@@ -1,7 +1,7 @@
package org.luaj.vm2.require; package org.luaj.vm2.require;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
/** /**
* This should fail while trying to load via * This should fail while trying to load via

View File

@@ -1,7 +1,7 @@
package org.luaj.vm2.require; package org.luaj.vm2.require;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.ZeroArgFunction; import org.luaj.vm2.libs.ZeroArgFunction;
/** /**
* This should fail while trying to load via "require()" because it throws a RuntimeException * This should fail while trying to load via "require()" because it throws a RuntimeException

View File

@@ -1,7 +1,7 @@
package org.luaj.vm2.require; package org.luaj.vm2.require;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.TwoArgFunction; import org.luaj.vm2.libs.TwoArgFunction;
/** /**
* This should succeed as a library that can be loaded dynamically via "require()" * This should succeed as a library that can be loaded dynamically via "require()"

View File

@@ -40,7 +40,7 @@ import junit.framework.TestSuite;
import org.luaj.vm2.LuaFunction; import org.luaj.vm2.LuaFunction;
import org.luaj.vm2.LuaValue; import org.luaj.vm2.LuaValue;
import org.luaj.vm2.lib.OneArgFunction; import org.luaj.vm2.libs.OneArgFunction;
public class ScriptEngineTests extends TestSuite { public class ScriptEngineTests extends TestSuite {