public void init() {
        if (isLua()) {
            pc = 0;
            if (closure.prototype.isVararg) {
                localBase += nArguments;

                setTop(closure.prototype.maxStacksize);
                int toCopy = Math.min(nArguments, closure.prototype.numParams);
                stackCopy(-nArguments, 0, toCopy);
            } else {
                setTop(closure.prototype.maxStacksize);
                stackClear(closure.prototype.numParams, nArguments);
            }
        }
    }
This ensures that top is at least as high as index, and that everything from index and up is empty.
@param index
main/src/main/java/cgeo/geocaching/wherigo/kahlua/vm/LuaCallFrame.java