Showing the changes to src/core/chuck_lang.cpp (1 of 6 files). Show all
Unified · Split
| @@ -970,6 +970,11 @@ t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type ) · 969 unmodified lines | ||
| 970 | 970 | func->add_arg( "string[]", "keys" ); |
| 971 | 971 | func->doc = "return all keys found in associative array in keys"; |
| 972 | 972 | if( !type_engine_import_mfun( env, func ) ) goto error; |
| 973 | + | |
| 974 | + // (1.4.2.1 azaday) add reverse() | |
| 975 | + func = make_new_mfun( "void", "reverse", array_reverse ); | |
| 976 | + func->doc = "reverses the array in-place"; | |
| 977 | + if( !type_engine_import_mfun( env, func ) ) goto error; | |
| 973 | 978 | |
| 974 | 979 | // note 1.4.1.0: in the future, should deprecate and encourage programmer |
| 975 | 980 | // to explicitly use .size() OR .capacity(), depending on the context |
| @@ -2782,6 +2787,13 @@ CK_DLL_MFUN( array_get_keys ) · 1806 unmodified lines | ||
| 2782 | 2787 | } |
| 2783 | 2788 | } |
| 2784 | 2789 | |
| 2790 | +// 1.4.2.1 azaday (added) array.reverse() | |
| 2791 | +CK_DLL_MFUN( array_reverse ) | |
| 2792 | +{ | |
| 2793 | + Chuck_Array * array = (Chuck_Array *)SELF; | |
| 2794 | + array->reverse(); | |
| 2795 | +} | |
| 2796 | + | |
| 2785 | 2797 | |
| 2786 | 2798 | |
| 2787 | 2799 | //----------------------------------------------------------------------------- |