339 lines
13 KiB
Markdown
339 lines
13 KiB
Markdown
The Rhai Scripting Language
|
||
==========================
|
||
|
||
[The Rhai Book](index.md)
|
||
|
||
----------------------
|
||
|
||
User’s Guide
|
||
============
|
||
|
||
- [Introduction](about/index.md)
|
||
- [Features of Rhai](about/features.md)
|
||
- [What Rhai Isn't](about/non-design.md)
|
||
- [Benchmarks](about/benchmarks.md)
|
||
- [Supported Targets and Builds](about/targets.md)
|
||
- [Dependencies](about/dependencies.md)
|
||
- [Licensing](about/license.md)
|
||
- [Related Resources](about/related.md)
|
||
- [Getting Started](start/index.md)
|
||
- [Online Playground](start/playground.md)
|
||
- [Install the Rhai Crate](start/install.md)
|
||
- [Optional Features](start/features.md)
|
||
- [Packaged Utilities](start/bin.md)
|
||
- [The Scripting Engine](engine/index.md)
|
||
- [“Hello, Rhai”](engine/hello-world.md)
|
||
- [Compile to AST](engine/compile.md)
|
||
- [Raw Engine](engine/raw.md)
|
||
- [Built-in Operators](engine/builtin.md)
|
||
- [Scope – Maintaining State](engine/scope.md)
|
||
- [Expressions Only](engine/expressions.md)
|
||
- [Options](engine/options.md)
|
||
- [Examples](start/examples/index.md)
|
||
- [Rust](start/examples/rust.md)
|
||
- [Scripts](start/examples/scripts.md)
|
||
- [Special Builds](start/builds/index.md)
|
||
- [Performance](start/builds/performance.md)
|
||
- [Minimal](start/builds/minimal.md)
|
||
- [no-std](start/builds/no-std.md)
|
||
- [WebAssembly (WASM)](start/builds/wasm.md)
|
||
|
||
----------------------
|
||
|
||
Rust Integration
|
||
================
|
||
|
||
- [Introduction](rust/index.md)
|
||
- [Traits](rust/traits.md)
|
||
- [Register a Rust Function](rust/functions.md)
|
||
- [Function Overloading](rust/overloading.md)
|
||
- [Generic Functions](rust/generic.md)
|
||
- [String Parameters](rust/strings.md)
|
||
- [`Dynamic` Parameters](rust/dynamic-args.md)
|
||
- [`Dynamic` Return Value](rust/dynamic-return.md)
|
||
- [Fallible Functions](rust/fallible.md)
|
||
- [`NativeCallContext`](rust/context.md)
|
||
- [Restore `NativeCallContext`](rust/context-restore.md)
|
||
- [Override a Built-in Function](rust/override.md)
|
||
- [Call a Rhai Function from Rust](engine/call-fn.md)
|
||
- [Create a Rust Closure from a Rhai Function](engine/func.md)
|
||
- [Operator Overloading](rust/operators.md)
|
||
- [Working with Any Rust Type](rust/custom-types.md)
|
||
- [Auto-Generate API](rust/derive-custom-type.md)
|
||
- [Custom Type Builder](rust/build-type.md)
|
||
- [Manually Register Custom Type](rust/reg-custom-type.md)
|
||
- [Methods](rust/methods.md)
|
||
- [Call Method as Function](rust/methods-fn-call.md)
|
||
- [Property Getters and Setters](rust/getters-setters.md)
|
||
- [Indexers](rust/indexers.md)
|
||
- [Fallback to Properties](rust/indexer-prop-fallback.md)
|
||
- [Collection Types](rust/collections.md)
|
||
- [Disable Custom Types](rust/disable-custom.md)
|
||
- [Printing Custom Types](rust/print-custom.md)
|
||
- [Modules](rust/modules/index.md)
|
||
- [Create in Rust](rust/modules/create.md)
|
||
- [Create from AST](rust/modules/ast.md)
|
||
- [Use a Module](rust/modules/use.md)
|
||
- [Module Resolvers](rust/modules/resolvers/index.md)
|
||
- [Built-in Module Resolvers](rust/modules/resolvers/built-in.md)
|
||
- [`DummyModuleResolver`](rust/modules/resolvers/dummy.md)
|
||
- [`FileModuleResolver`](rust/modules/resolvers/file.md)
|
||
- [`StaticModuleResolver`](rust/modules/resolvers/static.md)
|
||
- [`ModuleResolversCollection`](rust/modules/resolvers/collection.md)
|
||
- [`DylibModuleResolver` (external)](rust/modules/resolvers/dylib.md)
|
||
- [Custom Module Resolvers](rust/modules/resolvers/custom.md)
|
||
- [Self-Contained AST](rust/modules/self-contained.md)
|
||
- [Plugin Modules](plugins/index.md)
|
||
- [Packages](rust/packages/index.md)
|
||
- [Built-in Packages](rust/packages/builtin.md)
|
||
- [Create Custom Packages](rust/packages/create.md)
|
||
- [Create Packages as Crates](rust/packages/crate.md)
|
||
- [External Packages](lib/index.md)
|
||
- [Random Number Generation, Shuffling and Sampling](lib/rhai-rand.md)
|
||
- [Scientific Computing](lib/rhai-sci.md)
|
||
- [AI and Machine Learning](lib/rhai-ml.md)
|
||
- [Filesystem Access](lib/rhai-fs.md)
|
||
- [Working with Urls](lib/rhai-url.md)
|
||
|
||
----------------------
|
||
|
||
Scripting Language
|
||
==================
|
||
|
||
- [Comments](language/comments.md)
|
||
- [Doc-Comments](language/doc-comments.md)
|
||
- [Values and Types](language/values-and-types.md)
|
||
- [`Dynamic` Values](language/dynamic.md)
|
||
- [type_of()](language/type-of.md)
|
||
- [Interop with Rust](language/dynamic-rust.md)
|
||
- [Value Tag](language/dynamic-tag.md)
|
||
- [Serialization/Deserialization with `serde`](rust/serde.md)
|
||
- [Numbers](language/numbers.md)
|
||
- [Operators](language/num-op.md)
|
||
- [Standard Functions](language/num-fn.md)
|
||
- [Value Conversions](language/convert.md)
|
||
- [Ranges](language/ranges.md)
|
||
- [Bit-Fields](language/bit-fields.md)
|
||
- [Strings and Characters](language/strings-chars.md)
|
||
- [String Interpolation](language/string-interp.md)
|
||
- [`ImmutableString`](rust/immutable-string.md)
|
||
- [Standard Functions and Operators](language/string-fn.md)
|
||
- [Strings Interner](rust/strings-interner.md)
|
||
- [Arrays](language/arrays.md)
|
||
- [BLOB's (Byte Arrays)](language/blobs.md)
|
||
- [Out-of-Bounds Index](language/arrays-oob.md)
|
||
- [Object Maps](language/object-maps.md)
|
||
- [Parse from JSON](language/json.md)
|
||
- [Special Support for OOP](language/object-maps-oop.md)
|
||
- [Non-Existent Property](language/object-maps-missing-prop.md)
|
||
- [Timestamps](language/timestamps.md)
|
||
- [Keywords](language/keywords.md)
|
||
- [Statements](language/statements.md)
|
||
- [Statement Expression](language/statement-expression.md)
|
||
- [Variables](language/variables.md)
|
||
- [Variable Shadowing](language/shadow.md)
|
||
- [Strict Variables Mode](engine/strict-var.md)
|
||
- [Variable Definition Filter](engine/def-var.md)
|
||
- [Variable Resolver](engine/var.md)
|
||
- [Constants](language/constants.md)
|
||
- [Automatic Global Module](language/global.md)
|
||
- [Assignments](language/assignment.md)
|
||
- [Compound Assignments](language/assignment-op.md)
|
||
- [Logic Operators](language/logic.md)
|
||
- [In Operator](language/in.md)
|
||
- [If Statement](language/if.md)
|
||
- [Switch Statement](language/switch.md)
|
||
- [Switch Expression](language/switch-expression.md)
|
||
- [While Loop](language/while.md)
|
||
- [Do Loop](language/do.md)
|
||
- [Loop Statement](language/loop.md)
|
||
- [For Loop](language/for.md)
|
||
- [Standard Iterable Types](language/iter.md)
|
||
- [Make a Custom Type Iterable](language/iterator.md)
|
||
- [Return Value](language/return.md)
|
||
- [Throw Exception on Error](language/throw.md)
|
||
- [Catch Exceptions](language/try-catch.md)
|
||
- [Functions](language/functions.md)
|
||
- [Method Calls](language/fn-method.md)
|
||
- [Overloading](language/overload.md)
|
||
- [Namespaces](language/fn-namespaces.md)
|
||
- [Function Pointers](language/fn-ptr.md)
|
||
- [Currying](language/fn-curry.md)
|
||
- [Anonymous Functions](language/fn-anon.md)
|
||
- [Closures](language/fn-closure.md)
|
||
- [Metadata](engine/metadata/index.md)
|
||
- [Get Scripted Functions Metadata in Rhai](language/fn-metadata.md)
|
||
- [Get Scripted Functions Metadata from AST](rust/functions-metadata.md)
|
||
- [Get Native Function Signatures](engine/metadata/gen_fn_sig.md)
|
||
- [Export All Functions Metadata to JSON](engine/metadata/export_to_json.md)
|
||
- [Generate Definition Files for Language Server](engine/metadata/definitions.md)
|
||
- [Print and Debug](language/print-debug.md)
|
||
- [Modules](language/modules/index.md)
|
||
- [Export Variables, Functions and Sub-Modules from Script](language/modules/export.md)
|
||
- [Import Modules](language/modules/import.md)
|
||
- [Eval Function](language/eval.md)
|
||
|
||
----------------------
|
||
|
||
Safety and Protection
|
||
=====================
|
||
|
||
- [Introduction](safety/index.md)
|
||
- [Sand-Boxing](safety/sandbox.md)
|
||
- [Limiting Run Time](safety/progress.md)
|
||
- [Limiting Memory Usage](safety/memory.md)
|
||
- [Limiting Stack Usage](safety/stack.md)
|
||
- [Built-in Safety Limits](safety/limits.md)
|
||
- [Maximum Length of Strings](safety/max-string-size.md)
|
||
- [Maximum Size of Arrays](safety/max-array-size.md)
|
||
- [Maximum Size of Object Maps](safety/max-map-size.md)
|
||
- [Maximum Number of Operations](safety/max-operations.md)
|
||
- [Maximum Number of Variables](safety/max-variables.md)
|
||
- [Maximum Number of Functions](safety/max-functions.md)
|
||
- [Maximum Number of Modules](safety/max-modules.md)
|
||
- [Maximum Call Stack Depth](safety/max-call-stack.md)
|
||
- [Maximum Expression Depth](safety/max-stmt-depth.md)
|
||
- [Turn Off Safety Checks](safety/checked.md)
|
||
|
||
----------------------
|
||
|
||
Script Optimization
|
||
===================
|
||
|
||
- [Introduction](engine/optimize/index.md)
|
||
- [Optimization Passes](engine/optimize/passes.md)
|
||
- [Dead Code Elimination](engine/optimize/dead-code.md)
|
||
- [Constants Propagation](engine/optimize/constants.md)
|
||
- [Compound Assignment Rewrite](engine/optimize/rewrite.md)
|
||
- [Eager Operator Evaluation](engine/optimize/op-eval.md)
|
||
- [Eager Function Evaluation](engine/optimize/eager.md)
|
||
- [Side-Effect Considerations](engine/optimize/side-effects.md)
|
||
- [Volatility Considerations](engine/optimize/volatility.md)
|
||
- [Subtle Semantic Changes](engine/optimize/semantics.md)
|
||
- [Re-Optimize an `AST`](engine/optimize/reoptimize.md)
|
||
|
||
----------------------
|
||
|
||
Advanced Topics
|
||
===============
|
||
|
||
- [Manage AST's](engine/ast.md)
|
||
- [Low-Level API to Register Functions](rust/register-raw.md)
|
||
- [Evaluation Context](engine/eval-context.md)
|
||
- [Call Function Within Caller's Scope](language/fn-parent-scope.md)
|
||
- [Use Rhai in Dynamic Libraries](engine/dynamic-lib.md)
|
||
- [Use Rhai as a DSL](engine/dsl.md)
|
||
- [Remap Tokens During Parsing](engine/token-mapper.md)
|
||
- [Disable Keywords and/or Operators](engine/disable-keywords.md)
|
||
- [Disable Looping](engine/disable-looping.md)
|
||
- [Custom Operators](engine/custom-op.md)
|
||
- [Operator Precedence](engine/precedence.md)
|
||
- [Extend with Custom Syntax](engine/custom-syntax.md)
|
||
- [Custom Syntax Parsers](engine/custom-syntax-parsers.md)
|
||
- [Debugging Interface](engine/debugging/index.md)
|
||
- [Debugger](engine/debugging/debugger.md)
|
||
- [State](engine/debugging/state.md)
|
||
- [Call Stack](engine/debugging/call-stack.md)
|
||
- [Break-Points](engine/debugging/break-points.md)
|
||
- [Debugging Server](engine/debugging/server.md)
|
||
|
||
----------------------
|
||
|
||
Usage Patterns
|
||
==============
|
||
|
||
- [Object-Oriented Programming (OOP)](patterns/oop.md)
|
||
- [Scriptable Event Handler with State](patterns/events.md)
|
||
- [Main Style](patterns/events-1.md)
|
||
- [JS Style](patterns/events-2.md)
|
||
- [Map Style](patterns/events-3.md)
|
||
- [Control Layer Over Rust Backend](patterns/control.md)
|
||
- [Singleton Command Object](patterns/singleton.md)
|
||
- [Loadable Configuration](patterns/config.md)
|
||
- [Multi-Layered Functions](patterns/multi-layer.md)
|
||
- [Hot Reloading](patterns/hot-reload.md)
|
||
- [Builder Pattern / Fluent API](patterns/builder.md)
|
||
- [Objects with Defined Behaviors](patterns/objects.md)
|
||
- [Dynamic Constants Provider](patterns/dynamic-const.md)
|
||
- [Global Constants](patterns/constants.md)
|
||
- [Mutable Global State](patterns/global-mutable-state.md)
|
||
- [Working with Rust Enums](patterns/enums.md)
|
||
- [Simulate Macros to Simplify Scripts](patterns/macros.md)
|
||
- [One Engine Instance Per Call](patterns/parallel.md)
|
||
- [Multi-Threaded Synchronization](patterns/multi-threading.md)
|
||
- [Blocking/Async Function Calls](patterns/blocking.md)
|
||
- [External References (Unsafe)](patterns/references.md)
|
||
- [Static Hashing](patterns/static-hash.md)
|
||
- [Serialize an AST](patterns/serialize-ast.md)
|
||
- [Domain-Specific Tools](patterns/domain-tools.md)
|
||
- [Multiple Instantiation](patterns/multiple.md)
|
||
|
||
----------------------
|
||
|
||
Language Reference
|
||
==================
|
||
|
||
- [Introduction](ref/index.md)
|
||
- [Comments](ref/comments.md)
|
||
- [Value Types](ref/values-and-types.md)
|
||
- [`Dynamic` Values](ref/dynamic.md)
|
||
- [type_of()](ref/type-of.md)
|
||
- [Value Tag](ref/dynamic-tag.md)
|
||
- [Numbers](ref/numbers.md)
|
||
- [Operators](ref/num-op.md)
|
||
- [Standard Functions](ref/num-fn.md)
|
||
- [Value Conversions](ref/convert.md)
|
||
- [Ranges](ref/ranges.md)
|
||
- [Bit-Fields](ref/bit-fields.md)
|
||
- [Strings and Characters](ref/strings-chars.md)
|
||
- [Standard Functions and Operators](ref/string-fn.md)
|
||
- [Arrays](ref/arrays.md)
|
||
- [BLOB's (Byte Arrays)](ref/blobs.md)
|
||
- [Object Maps](ref/object-maps.md)
|
||
- [Timestamps](ref/timestamps.md)
|
||
- [Keywords](ref/keywords.md)
|
||
- [Statements](ref/statements.md)
|
||
- [Variables](ref/variables.md)
|
||
- [Constants](ref/constants.md)
|
||
- [Assignments](ref/assignment.md)
|
||
- [Compound Assignments](ref/assignment-op.md)
|
||
- [Operators](ref/operators.md)
|
||
- [Indexing](ref/indexing.md)
|
||
- [Properties](ref/getters-setters.md)
|
||
- [Methods](ref/methods.md)
|
||
- [If Statement](ref/if.md)
|
||
- [Switch Statement](ref/switch.md)
|
||
- [While Loop](ref/while.md)
|
||
- [Do Loop](ref/do.md)
|
||
- [Infinite Loop](ref/loop.md)
|
||
- [For Loop](ref/for.md)
|
||
- [Return Value](ref/return.md)
|
||
- [Throw Exception on Error](ref/throw.md)
|
||
- [Catch Exceptions](ref/try-catch.md)
|
||
- [Functions](ref/functions.md)
|
||
- [Method Calls](ref/fn-method.md)
|
||
- [Overloading](ref/overload.md)
|
||
- [Function Pointers](ref/fn-ptr.md)
|
||
- [Closures](ref/fn-closure.md)
|
||
- [Metadata](ref/fn-metadata.md)
|
||
- [Print and Debug](ref/print-debug.md)
|
||
- [Modules](ref/modules/index.md)
|
||
- [Export Variables, Functions and Sub-Modules from Script](ref/modules/export.md)
|
||
- [Import Modules](ref/modules/import.md)
|
||
- [Eval Function](ref/eval.md)
|
||
|
||
----------------------
|
||
|
||
Appendix
|
||
========
|
||
|
||
- [External Tools](tools/index.md)
|
||
- [Online Playground](tools/playground.md)
|
||
- [Language Server](tools/lsp.md)
|
||
- [`rhai-doc`](tools/rhai-doc.md)
|
||
- [Dynamic Loadable Libraries](lib/rhai-dylib.md)
|
||
- [Generate MarkDown/MDX API Documentation](lib/rhai-autodocs.md)
|
||
- [Keywords](appendix/keywords.md)
|
||
- [Operators and Symbols](appendix/operators.md)
|
||
- [Literals](appendix/literals.md)
|