MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / define_builtin_functions

Function define_builtin_functions

aiscript-vm/src/builtins/mod.rs:89–119  ·  view source on GitHub ↗
(state: &mut State)

Source from the content-addressed store, hash-verified

87}
88
89pub(crate) fn define_builtin_functions(state: &mut State) {
90 [
91 ("abs", NativeFn(abs)),
92 ("all", NativeFn(all)),
93 ("any", NativeFn(any)),
94 ("ascii", NativeFn(ascii)),
95 ("bin", NativeFn(bin)),
96 ("bool", NativeFn(bool)),
97 ("callable", NativeFn(callable)),
98 ("chr", NativeFn(chr)),
99 ("filter", NativeFn(filter)),
100 ("float", NativeFn(float)),
101 ("format", NativeFn(format)),
102 ("hex", NativeFn(hex)),
103 ("input", NativeFn(input)),
104 ("int", NativeFn(int)),
105 ("len", NativeFn(len)),
106 ("map", NativeFn(map)),
107 ("max", NativeFn(max)),
108 ("min", NativeFn(min)),
109 ("oct", NativeFn(oct)),
110 ("ord", NativeFn(ord)),
111 ("print", NativeFn(print)),
112 ("round", NativeFn(round)),
113 ("str", NativeFn(str)),
114 ("sum", NativeFn(sum)),
115 ("zip", NativeFn(zip)),
116 ]
117 .into_iter()
118 .for_each(|(name, func)| state.define_native_function(name, func));
119}
120
121fn abs<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {
122 if args.len() != 1 {

Callers 1

compileMethod · 0.85

Calls 2

NativeFnClass · 0.85

Tested by

no test coverage detected