19 lines
567 B
Plaintext
19 lines
567 B
Plaintext
|
|
// Python plugin demo: kwargs call via callKw
|
||
|
|
// Build plugin:
|
||
|
|
// (cd plugins/nyash-python-plugin && cargo build --release)
|
||
|
|
// Run (with auto-decode optional):
|
||
|
|
// NYASH_PY_AUTODECODE=1 NYASH_CLI_VERBOSE=1 ./target/release/nyash --backend vm examples/py_kw_round_demo.nyash
|
||
|
|
|
||
|
|
static box Main {
|
||
|
|
main() {
|
||
|
|
local py, bi, roundf, r
|
||
|
|
py = new PyRuntimeBox()
|
||
|
|
bi = py.import("builtins")
|
||
|
|
f = bi.getattr("int")
|
||
|
|
// int(x="FF", base=16) => 255
|
||
|
|
r = f.callKw("x", "FF", "base", 16)
|
||
|
|
me.console.log("int(x='FF', base=16)=", r.str())
|
||
|
|
return 0
|
||
|
|
}
|
||
|
|
}
|