-
Notifications
You must be signed in to change notification settings - Fork 0
ArgsJS
YukkuriC edited this page Sep 4, 2026
·
2 revisions
basically a forwarder for various built-in Kotlin extension functions
- used on a mutable iota list manually, or called from
ActionJS.setOperateArgsSplit - typed getters (
double,vec3,entity, ...) with auto mishaps on missing args or wrong types
let { ActionJS, ArgsJS } = HexJS
// calling `new ArgsJS(stack, 3)` on stack [0,1,2,3,4]
// results in an `ArgsJS` object holding [4,3,2] and stack of [0,1]
// `new ArgsJS(stack, 3, true)` keeps the source stack unchanged instead
// manually creating
let action = new ActionJS().setOperateMutableStack(2, (stack, env/*, ...*/) => {
let args = new ArgsJS(stack, 3)
let aVec = args.vec3(0) // data.getVec3(0)
let aBoolean = args.bool(1) // data.getBool(1)
})
// auto-split from ActionJS pipe method variant
let action2 = new ActionJS().setOperateArgsSplit(2, (args, env/*, ...*/) => {
let anEntity = args.entity(0) // data.getEntity(env.world, 0)
let aNumber = args.double(1) // data.getDouble(1)
})