private int logMessage (LuaCallFrame callFrame, int nArguments) {
        if (nArguments < 1) return 0;
        Object arg = callFrame.get(0);
        String text;
        if (arg instanceof LuaTable) {
            LuaTable lt = (LuaTable)arg;
            text = (String)lt.rawget("Text");
        } else {
            text = arg.toString();
        }
        if (text != null && text.length() == 0) return 0;
        Engine.log("CUST: " + text, Engine.LOG_CALL);
        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