1. The Rhai Book
  2. User’s Guide
  3. Introduction
    1. Features of Rhai
    2. What Rhai Isn't
    3. Benchmarks
    4. Supported Targets and Builds
    5. Dependencies
    6. Licensing
    7. Related Resources
  4. Getting Started
    1. Online Playground
    2. Install the Rhai Crate
    3. Optional Features
    4. Packaged Utilities
  5. The Scripting Engine
    1. “Hello, Rhai”
    2. Compile to AST
    3. Raw Engine
      1. Built-in Operators
    4. Scope – Maintaining State
    5. Expressions Only
    6. Options
  6. Examples
    1. Rust
    2. Scripts
  7. Special Builds
    1. Performance
    2. Minimal
    3. no-std
    4. WebAssembly (WASM)
  8. Rust Integration
  9. Introduction
  10. Traits
  11. Register a Rust Function
    1. Function Overloading
    2. Generic Functions
    3. String Parameters
    4. Dynamic Parameters
    5. Dynamic Return Value
    6. Fallible Functions
    7. NativeCallContext
      1. Restore NativeCallContext
    8. Override a Built-in Function
  12. Call a Rhai Function from Rust
    1. Create a Rust Closure from a Rhai Function
  13. Operator Overloading
  14. Working with Any Rust Type
    1. Auto-Generate API
    2. Custom Type Builder
    3. Manually Register Custom Type
    4. Methods
      1. Call Method as Function
    5. Property Getters and Setters
    6. Indexers
      1. Fallback to Properties
    7. Collection Types
    8. Disable Custom Types
    9. Printing Custom Types
  15. Modules
    1. Create in Rust
    2. Create from AST
    3. Use a Module
    4. Module Resolvers
      1. Built-in Module Resolvers
        1. DummyModuleResolver
        2. FileModuleResolver
        3. StaticModuleResolver
        4. ModuleResolversCollection
        5. DylibModuleResolver (external)
      2. Custom Module Resolvers
    5. Self-Contained AST
  16. Plugin Modules
  17. Packages
    1. Built-in Packages
    2. Create Custom Packages
    3. Create Packages as Crates
    4. External Packages
      1. Random Number Generation, Shuffling and Sampling
      2. Scientific Computing
      3. AI and Machine Learning
      4. Filesystem Access
      5. Working with Urls
  18. Scripting Language
  19. Comments
    1. Doc-Comments
  20. Values and Types
    1. Dynamic Values
      1. type_of()
      2. Interop with Rust
      3. Value Tag
      4. Serialization/Deserialization with serde
    2. Numbers
      1. Operators
      2. Standard Functions
      3. Value Conversions
      4. Ranges
      5. Bit-Fields
    3. Strings and Characters
      1. String Interpolation
      2. ImmutableString
      3. Standard Functions and Operators
      4. Strings Interner
    4. Arrays
      1. BLOB's (Byte Arrays)
      2. Out-of-Bounds Index
    5. Object Maps
      1. Parse from JSON
      2. Special Support for OOP
      3. Non-Existent Property
    6. Timestamps
  21. Keywords
  22. Statements
    1. Statement Expression
  23. Variables
    1. Variable Shadowing
    2. Strict Variables Mode
    3. Variable Definition Filter
    4. Variable Resolver
  24. Constants
    1. Automatic Global Module
  25. Assignments
  26. Compound Assignments
  27. Logic Operators
  28. In Operator
  29. If Statement
  30. Switch Statement
    1. Switch Expression
  31. While Loop
  32. Do Loop
  33. Loop Statement
  34. For Loop
    1. Standard Iterable Types
    2. Make a Custom Type Iterable
  35. Return Value
  36. Throw Exception on Error
  37. Catch Exceptions
  38. Functions
    1. Method Calls
    2. Overloading
    3. Namespaces
    4. Function Pointers
      1. Currying
      2. Anonymous Functions
      3. Closures
    5. Metadata
      1. Get Scripted Functions Metadata in Rhai
      2. Get Scripted Functions Metadata from AST
      3. Get Native Function Signatures
      4. Export All Functions Metadata to JSON
      5. Generate Definition Files for Language Server
  39. Print and Debug
  40. Modules
    1. Export Variables, Functions and Sub-Modules from Script
    2. Import Modules
  41. Eval Function
  42. Safety and Protection
  43. Introduction
  44. Sand-Boxing
  45. Limiting Run Time
  46. Limiting Memory Usage
  47. Limiting Stack Usage
  48. Built-in Safety Limits
    1. Maximum Length of Strings
    2. Maximum Size of Arrays
    3. Maximum Size of Object Maps
    4. Maximum Number of Operations
    5. Maximum Number of Variables
    6. Maximum Number of Functions
    7. Maximum Number of Modules
    8. Maximum Call Stack Depth
    9. Maximum Expression Depth
  49. Turn Off Safety Checks
  50. Script Optimization
  51. Introduction
  52. Optimization Passes
    1. Dead Code Elimination
    2. Constants Propagation
    3. Compound Assignment Rewrite
    4. Eager Operator Evaluation
    5. Eager Function Evaluation
      1. Side-Effect Considerations
      2. Volatility Considerations
  53. Subtle Semantic Changes
  54. Re-Optimize an AST
  55. Advanced Topics
  56. Manage AST's
  57. Low-Level API to Register Functions
  58. Evaluation Context
  59. Call Function Within Caller's Scope
  60. Use Rhai in Dynamic Libraries
  61. Use Rhai as a DSL
    1. Remap Tokens During Parsing
    2. Disable Keywords and/or Operators
    3. Disable Looping
    4. Custom Operators
      1. Operator Precedence
    5. Extend with Custom Syntax
      1. Custom Syntax Parsers
  62. Debugging Interface
    1. Debugger
      1. State
      2. Call Stack
      3. Break-Points
    2. Debugging Server
  63. Usage Patterns
  64. Object-Oriented Programming (OOP)
  65. Scriptable Event Handler with State
    1. Main Style
    2. JS Style
    3. Map Style
  66. Control Layer Over Rust Backend
  67. Singleton Command Object
  68. Loadable Configuration
  69. Multi-Layered Functions
  70. Hot Reloading
  71. Builder Pattern / Fluent API
  72. Objects with Defined Behaviors
  73. Dynamic Constants Provider
  74. Global Constants
  75. Mutable Global State
  76. Working with Rust Enums
  77. Simulate Macros to Simplify Scripts
  78. One Engine Instance Per Call
  79. Multi-Threaded Synchronization
  80. Blocking/Async Function Calls
  81. External References (Unsafe)
  82. Static Hashing
  83. Serialize an AST
  84. Domain-Specific Tools
  85. Multiple Instantiation
  86. Language Reference
  87. Introduction
  88. Comments
  89. Value Types
    1. Dynamic Values
      1. type_of()
      2. Value Tag
    2. Numbers
      1. Operators
      2. Standard Functions
      3. Value Conversions
      4. Ranges
      5. Bit-Fields
    3. Strings and Characters
      1. Standard Functions and Operators
    4. Arrays
    5. BLOB's (Byte Arrays)
    6. Object Maps
    7. Timestamps
  90. Keywords
  91. Statements
  92. Variables
  93. Constants
  94. Assignments
    1. Compound Assignments
  95. Operators
  96. Indexing
  97. Properties
  98. Methods
  99. If Statement
  100. Switch Statement
  101. While Loop
  102. Do Loop
  103. Infinite Loop
  104. For Loop
  105. Return Value
  106. Throw Exception on Error
    1. Catch Exceptions
  107. Functions
    1. Method Calls
    2. Overloading
    3. Function Pointers
    4. Closures
    5. Metadata
  108. Print and Debug
  109. Modules
    1. Export Variables, Functions and Sub-Modules from Script
    2. Import Modules
  110. Eval Function
  111. Appendix
  112. External Tools
    1. Online Playground
    2. Language Server
    3. rhai-doc
    4. Dynamic Loadable Libraries
    5. Generate MarkDown/MDX API Documentation
  113. Keywords
  114. Operators and Symbols
  115. Literals