mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-05 15:00:29 +00:00
Move Bit32 library to LuaJ sources
This commit is contained in:
parent
084bbe8480
commit
6fca136327
Binary file not shown.
@ -19,22 +19,18 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package dan200.computercraft.core.lua;
|
package org.luaj.vm2.lib;
|
||||||
|
|
||||||
import org.luaj.vm2.LuaInteger;
|
import org.luaj.vm2.LuaInteger;
|
||||||
import org.luaj.vm2.LuaTable;
|
import org.luaj.vm2.LuaTable;
|
||||||
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.lib.VarArgFunction;
|
|
||||||
import org.luaj.vm2.lib.ZeroArgFunction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass of LibFunction that implements the Lua standard {@code bit32} library.
|
* Subclass of LibFunction that implements the Lua standard {@code bit32} library.
|
||||||
*/
|
*/
|
||||||
public class LuaJBit32Lib extends ZeroArgFunction
|
public class Bit32Lib extends ZeroArgFunction
|
||||||
{
|
{
|
||||||
@Override
|
|
||||||
public LuaValue call( )
|
public LuaValue call( )
|
||||||
{
|
{
|
||||||
LuaTable t = new LuaTable();
|
LuaTable t = new LuaTable();
|
||||||
@ -50,7 +46,6 @@ public class LuaJBit32Lib extends ZeroArgFunction
|
|||||||
|
|
||||||
public static final class Bit32LibV extends VarArgFunction
|
public static final class Bit32LibV extends VarArgFunction
|
||||||
{
|
{
|
||||||
@Override
|
|
||||||
public Varargs invoke( Varargs args )
|
public Varargs invoke( Varargs args )
|
||||||
{
|
{
|
||||||
switch( opcode )
|
switch( opcode )
|
||||||
@ -126,7 +121,6 @@ public class LuaJBit32Lib extends ZeroArgFunction
|
|||||||
|
|
||||||
public static final class Bit32Lib2 extends TwoArgFunction
|
public static final class Bit32Lib2 extends TwoArgFunction
|
||||||
{
|
{
|
||||||
@Override
|
|
||||||
public LuaValue call( LuaValue arg1, LuaValue arg2 )
|
public LuaValue call( LuaValue arg1, LuaValue arg2 )
|
||||||
{
|
{
|
||||||
switch( opcode )
|
switch( opcode )
|
@ -17,6 +17,7 @@ import dan200.computercraft.core.computer.ITask;
|
|||||||
import dan200.computercraft.core.computer.MainThread;
|
import dan200.computercraft.core.computer.MainThread;
|
||||||
|
|
||||||
import org.luaj.vm2.*;
|
import org.luaj.vm2.*;
|
||||||
|
import org.luaj.vm2.lib.Bit32Lib;
|
||||||
import org.luaj.vm2.lib.OneArgFunction;
|
import org.luaj.vm2.lib.OneArgFunction;
|
||||||
import org.luaj.vm2.lib.VarArgFunction;
|
import org.luaj.vm2.lib.VarArgFunction;
|
||||||
import org.luaj.vm2.lib.ZeroArgFunction;
|
import org.luaj.vm2.lib.ZeroArgFunction;
|
||||||
@ -54,7 +55,7 @@ public class LuaJLuaMachine implements ILuaMachine
|
|||||||
|
|
||||||
// Create an environment to run in
|
// Create an environment to run in
|
||||||
m_globals = JsePlatform.debugGlobals();
|
m_globals = JsePlatform.debugGlobals();
|
||||||
m_globals.load( new LuaJBit32Lib() );
|
m_globals.load( new Bit32Lib() );
|
||||||
m_loadString = m_globals.get("loadstring");
|
m_loadString = m_globals.get("loadstring");
|
||||||
m_assert = m_globals.get("assert");
|
m_assert = m_globals.get("assert");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user