Title here
Summary here
Those are C++ functions, using the ArkScript virtual machine API to communicate with it. They can be used as any other function in ArkScript code.
#include <Ark/VM/VM.hpp>
#include <Ark/VM/Value.hpp>
Ark::Value myBuiltin(std::vector<Ark::Value>& parameters, Ark::VM* vm)
{
return Ark::Nil;
}
Inside the VM, they are all prefixed by builtin__
, and then remapped in their corresponding category in the standard library.
Eg builtin__list:sort
will have a definition inside std/List.ark
as (let sort (fun (_L) (builtin__list:sort _L)))
.
See the tutorial on embedding for more details on how to use them.
We currently have a few categories for our builtins:
io:
in ArkScriptlist:
in ArkScriptmath:
in ArkScriptstring:
in ArkScriptsys:
in ArkScriptinclude/Ark/Builtins/Builtins.hpp
under the right namespacesrc/arkreactor/Builtins/Builtins.cpp
, as follows: { "builtin__<name>", Value(category::functionName) }
src/arkreactor/Builtins/{category}.cpp
lib/std/{category}.ark
as (let <name> (fun (args...) (builtin__<name> args...)))