History

reverse feature and unit test + example

Andrew Aday committed 3 years ago

Commit e7ef3c81 parent 7686e906 files · +122 −0Browse files

Showing the changes to src/core/chuck_lang.cpp (1 of 6 files). Show all

Unified · Split

src/core/chuck_lang.cpp+12−0
@@ -970,6 +970,11 @@ t_CKBOOL init_class_array( Chuck_Env * env, Chuck_Type * type ) · 969 unmodified lines
970 func->add_arg( "string[]", "keys" );970 func->add_arg( "string[]", "keys" );
971 func->doc = "return all keys found in associative array in keys";971 func->doc = "return all keys found in associative array in keys";
972 if( !type_engine_import_mfun( env, func ) ) goto error;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 // note 1.4.1.0: in the future, should deprecate and encourage programmer979 // note 1.4.1.0: in the future, should deprecate and encourage programmer
975 // to explicitly use .size() OR .capacity(), depending on the context980 // 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()
2791CK_DLL_MFUN( array_reverse )
2792{
2793 Chuck_Array * array = (Chuck_Array *)SELF;
2794 array->reverse();
2795}
2796
2785 2797
2786 2798
2787//-----------------------------------------------------------------------------2799//-----------------------------------------------------------------------------

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t