Type coercion for luajava package, make luajava an "addon"

This commit is contained in:
James Roseborough
2007-06-24 15:04:19 +00:00
parent 1d7793f8e6
commit 93fc4699a9
18 changed files with 574 additions and 142 deletions

View File

@@ -4,7 +4,6 @@ import java.util.Hashtable;
import lua.value.LString;
import lua.value.LTable;
import lua.value.LValue;
/**
** `global state', shared by all threads of this state
@@ -42,11 +41,15 @@ public class GlobalState {
// TString *tmname[TM_N]; /* array with tag-method names */
// } global_State;
//
public static LValue getGlobalsTable() {
LTable table = new LTable();
Builtin.addBuiltins( table );
LuaJava.addBuiltins( table );
table.m_hash.put(new LString("_G"), table);
return table;
private static LTable _G;
static {
_G = new LTable();
Builtin.addBuiltins( _G );
_G .m_hash.put(new LString("_G"), _G );
}
public static LTable getGlobalsTable() {
return _G;
}
}