Skip to content

Commit

Permalink
Try run_script for Rhai
Browse files Browse the repository at this point in the history
  • Loading branch information
utensil committed Sep 26, 2024
1 parent a465e0b commit e1b6c1c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bun/rhai.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import init, { compile_script } from '../lib/rhaiscript/pkg'
import init, { compile_script, run_script } from '../lib/rhaiscript/pkg'

await init()

console.log(compile_script(`\
const script = `\
fn run(a) {
let b = a + 1;
print("Hello world! a = " + a);
}
run(10);
`))
`

console.log(compile_script(script))

console.log(
run_script(
script,
(s) => console.log(s),
(S) => console.debug(s),
),
)

0 comments on commit e1b6c1c

Please sign in to comment.