private int dialog (LuaCallFrame callFrame, int nArguments) {
        LuaTable lt = (LuaTable)callFrame.get(0);
        int n = lt.len();
        String[] texts = new String[n];
        Media[] media = new Media[n];
        for (int i = 1; i <= n; i++) {
            LuaTable item = (LuaTable)lt.rawget(new Double(i));
            texts[i-1] = Engine.removeHtml((String)item.rawget("Text"));
            media[i-1] = (Media)item.rawget("Media");
        }
        Engine.dialog(texts, media);
        return 0;
    }
Distance object's fake GetValue or __call method

Called from Lua code: dist:GetValue("metres") or dist("ft"),
where 'dist' is double, converts the number to specified units
and returns as double.
main/src/main/java/cgeo/geocaching/wherigo/openwig/WherigoLib.java