|
|
| version 1.23, 2024/10/23 23:53:06 | version 1.24, 2024/10/26 00:21:02 |
|---|---|
| Line 1034 static void _reverse(Request& r, MethodP | Line 1034 static void _reverse(Request& r, MethodP |
| r.write(result); | r.write(result); |
| } | } |
| static void _compact(Request& r, MethodParams&) { | static void _compact(Request& r, MethodParams& params) { |
| GET_SELF(r, VArray).array().compact(); | bool compact_undef=false; |
| if(params.count()>0){ | |
| const String& what=params.as_string(0, PARAMETER_MUST_BE_STRING); | |
| if(!what.is_empty()){ | |
| if(what != "undef") | |
| throw Exception(PARSER_RUNTIME, &what, "param must be empty or 'undef'"); | |
| compact_undef=true; | |
| } | |
| } | |
| GET_SELF(r, VArray).array().compact(compact_undef); | |
| } | } |
| Line 1097 MArray::MArray(): Methoded(VARRAY_TYPE) | Line 1106 MArray::MArray(): Methoded(VARRAY_TYPE) |
| // ^array.reverse[] | // ^array.reverse[] |
| add_native_method("reverse", Method::CT_DYNAMIC, _reverse, 0, 0); | add_native_method("reverse", Method::CT_DYNAMIC, _reverse, 0, 0); |
| // ^array.compact[] | // ^array.compact[[undef]] |
| add_native_method("compact", Method::CT_DYNAMIC, _compact, 0, 0); | add_native_method("compact", Method::CT_DYNAMIC, _compact, 0, 1); |
| // ^array._at[first|last[;'key'|'value'|'hash']] | // ^array._at[first|last[;'key'|'value'|'hash']] |
| // ^array._at([-+]offset)[['key'|'value'|'hash']] | // ^array._at([-+]offset)[['key'|'value'|'hash']] |