private int nocaseequals (LuaCallFrame callFrame, int nArguments) {
        Object a = callFrame.get(0); Object b = callFrame.get(1);
        String aa = a == null ? null : a.toString();
        String bb = b == null ? null : b.toString();
        boolean result = (aa == bb || (aa != null && aa.equalsIgnoreCase(bb)));
        callFrame.push(LuaState.toBoolean(result));
        return 1;
    }
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