Fix varargs handling
This commit is contained in:
@@ -16,7 +16,7 @@ public class LTable extends LValue {
|
||||
/** Metatable tag for intercepting table sets */
|
||||
private static final LString TM_NEWINDEX = new LString("__newindex");
|
||||
|
||||
private Hashtable m_hash = new Hashtable();
|
||||
public Hashtable m_hash = new Hashtable();
|
||||
|
||||
private Vector m_vector; // if non-null then size() > 0
|
||||
|
||||
@@ -53,16 +53,16 @@ public class LTable extends LValue {
|
||||
if (m_vector == null) {
|
||||
if (iKey == 0) {
|
||||
m_vector = new Vector();
|
||||
m_vector.add(val);
|
||||
m_vector.addElement(val);
|
||||
return;
|
||||
}
|
||||
} else if (iKey >= 0) {
|
||||
int size = m_vector.size();
|
||||
if (iKey < size) {
|
||||
m_vector.set(iKey, val);
|
||||
m_vector.setElementAt(val, iKey);
|
||||
return;
|
||||
} else if (iKey == size) {
|
||||
m_vector.add(iKey, val);
|
||||
m_vector.addElement(val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class LTable extends LValue {
|
||||
// where size = m_vector.size()
|
||||
//
|
||||
if ((iKey >= 0) && (iKey < m_vector.size())) {
|
||||
return (LValue) m_vector.get(iKey);
|
||||
return (LValue) m_vector.elementAt(iKey);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -235,7 +235,7 @@ public class LTable extends LValue {
|
||||
vm.setResult();
|
||||
if ((i >= 0) && (i < t.m_vector.size())) {
|
||||
vm.push(new LInteger(i+1));
|
||||
vm.push((LValue) t.m_vector.get(i));
|
||||
vm.push((LValue) t.m_vector.elementAt(i));
|
||||
++i;
|
||||
} else if ( e.hasMoreElements() ) {
|
||||
LValue key = (LValue) e.nextElement();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
LUA_HOME=/cygdrive/c/programs/lua5.1
|
||||
TESTS="test1 test2 test3 test4 test5 swingapp"
|
||||
TESTS="test2"
|
||||
TESTS=`echo *.lua`
|
||||
TESTS="test3.lua"
|
||||
for x in $TESTS
|
||||
do
|
||||
echo compiling $x
|
||||
${LUA_HOME}/luac5.1.exe -l -o ${x}.luac ${x}.lua
|
||||
${LUA_HOME}/lua5.1.exe ${x}.luac
|
||||
luac -l -o ${x}c ${x}
|
||||
lua ${x}c
|
||||
done
|
||||
|
||||
@@ -39,7 +39,6 @@ print( func(11, 12, 13) )
|
||||
print( func(23, 22, 21) )
|
||||
print( func(func(32,33,34), func(45,46,47), func(58,59,50)) )
|
||||
|
||||
--[[
|
||||
function p(a,...)
|
||||
print("a",a)
|
||||
print("...",...)
|
||||
@@ -50,4 +49,3 @@ p()
|
||||
p("q")
|
||||
p("q","r")
|
||||
p("q","r","s")
|
||||
--]]
|
||||
Binary file not shown.
Reference in New Issue
Block a user