Merge branch 'feature/list-where' of git://github.com/zeckalpha/wren into zeckalpha-feature/list-where
Conflicts: builtin/core.wren src/wren_core.c
This commit is contained in:
+10
-2
@@ -67,6 +67,14 @@ static const char* libSource =
|
||||
" }\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" where (f) {\n"
|
||||
" var result = []\n"
|
||||
" for (element in this) {\n"
|
||||
" if (f.call(element)) result.add(element)\n"
|
||||
" }\n"
|
||||
" return result\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
||||
// Validates that the given argument in [args] is a Num. Returns true if it is.
|
||||
@@ -275,9 +283,9 @@ static PrimitiveResult callFunction(WrenVM* vm, Value* args, int numArgs)
|
||||
{
|
||||
fn = AS_FN(args[0]);
|
||||
}
|
||||
|
||||
|
||||
if (numArgs < fn->numParams) RETURN_ERROR("Function expects more arguments.");
|
||||
|
||||
|
||||
return PRIM_CALL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user