Fix objlen, even though it is unused.

This commit is contained in:
Ian Farmer
2008-06-02 05:54:08 +00:00
parent 60323962f7
commit e4e95d593b

View File

@@ -22,6 +22,7 @@
package org.luaj.vm;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Stack;
@@ -1752,10 +1753,16 @@ public class LuaState extends Lua {
* is 0.
*/
public int objlen(int index) {
return tostring(index).length();
LValue p = topointer( index );
switch ( p.luaGetType() ) {
case LUA_TTABLE:
case LUA_TSTRING:
return p.luaLength();
default:
return 0;
}
}
/**
* Pops <code>n</code> elements from the stack. <span class="apii">[-n,
* +0, <em>-</em>]</span>