phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0
This commit is contained in:
20
examples/array_plugin_set_demo.hako
Normal file
20
examples/array_plugin_set_demo.hako
Normal file
@ -0,0 +1,20 @@
|
||||
// ArrayBox plugin demo (set)
|
||||
// Build plugin:
|
||||
// (cd plugins/nyash-array-plugin && cargo build --release)
|
||||
// Run (plugin host auto-loads from nyash.toml):
|
||||
// NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend vm examples/array_plugin_set_demo.hako
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local a
|
||||
a = new ArrayBox()
|
||||
a.push(10)
|
||||
a.push(20)
|
||||
a.push(30)
|
||||
me.console.log("before set, len=", a.length(), ", get(2)=", a.get(2))
|
||||
a.set(2, 42)
|
||||
me.console.log("after set, len=", a.length(), ", get(2)=", a.get(2))
|
||||
return a.get(2)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user