(state: &mut State)
| 87 | } |
| 88 | |
| 89 | pub(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 | |
| 121 | fn abs<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 122 | if args.len() != 1 { |
no test coverage detected