db/herodb/aiprompts/rhaiwrapping.md
2025-04-04 10:45:09 +02:00

601 B

in @src/zaz/rhai make wrappers for the src/zaz/models and see how to use them from src/zaz/cmd/examples.rs

how to do this you can find in rhaibook/rust

the wrappers need to be simple and return the result and if an error return a proper error into the rhai environment so the rhai script using the wrappers will get appropriate error

all wrapped functions need to be registered into the rhai engine

keep all code as small as possible

the creation of the db should not be done in the rhai script, this shouldd be done before we call the rhai script a db is context outside of the script execution