bug fix
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package lua.debug;
|
package lua.debug;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import lua.Lua;
|
import lua.Lua;
|
||||||
import lua.value.LTable;
|
import lua.value.LTable;
|
||||||
import lua.value.LValue;
|
import lua.value.LValue;
|
||||||
@@ -36,19 +39,28 @@ public class TableVariable extends Variable {
|
|||||||
|
|
||||||
int size = table.size();
|
int size = table.size();
|
||||||
DebugUtils.println("table size:" + size);
|
DebugUtils.println("table size:" + size);
|
||||||
this.keys = new String[size];
|
List keyArray = new ArrayList();
|
||||||
this.values = new Object[size];
|
List valueArray = new ArrayList();
|
||||||
LValue[] keyValues = table.getKeys();
|
LValue[] keyValues = table.getKeys();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
this.keys[i] = keyValues[i].toString();
|
|
||||||
LValue value = table.get(keyValues[i]);
|
LValue value = table.get(keyValues[i]);
|
||||||
|
if (value == table) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyArray.add(keyValues[i].toString());
|
||||||
if (value instanceof LTable) {
|
if (value instanceof LTable) {
|
||||||
this.values[i] = new TableVariable(i, "<table>", Lua.LUA_TTABLE, (LTable)value);
|
DebugUtils.println("table: value[" + i + "]=" + value.toString());
|
||||||
|
valueArray.add(new TableVariable(i, "element[" + keyValues[i].toString() + "]", Lua.LUA_TTABLE, (LTable)value));
|
||||||
} else {
|
} else {
|
||||||
this.values[i] = value.toString();
|
valueArray.add(value.toString());
|
||||||
}
|
}
|
||||||
DebugUtils.println("["+ keys[i] + "," + values[i].toString() + "]");
|
DebugUtils.println("["+ keyValues[i].toString() + "," + value.toString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.keys = (String[])keyArray.toArray(new String[0]);
|
||||||
|
this.values = valueArray.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getKeys() {
|
public String[] getKeys() {
|
||||||
|
|||||||
Reference in New Issue
Block a user