You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The context defines variables that are available, but not passed as arguments and also not the same value in every invocation of a script. The look like constants from the perspective of the script.
The Rust side would look something like this:
let rt = Runtime::new();
rt.register_context::<Logger>("LOGGER");// ...let f = rt.get_function(...).unwrap();
f.insert_ctx("LOGGER",Logger::new()).unwrap();let f = f.finish().unwrap();
f.call(ctx, ...);
Which would make the LOGGER variable available in Roto.
An open question is how this works with registered functions and whether they can use the context. For example, it would be nice if there could be a registered log function, that automatically uses the LOGGER.
The text was updated successfully, but these errors were encountered:
tertsdiepraam
changed the title
We need a way to define the "context" of a Roto script
"Context" of a Roto script
Dec 4, 2024
The most important advantage is that this struct can then also be used by registered functions. However, if they do, then they require a specific context type. That might need a bit more flexibility. They might be able to opt in to specific fields in the Ctx field.
The context defines variables that are available, but not passed as arguments and also not the same value in every invocation of a script. The look like constants from the perspective of the script.
The Rust side would look something like this:
Which would make the
LOGGER
variable available in Roto.An open question is how this works with registered functions and whether they can use the context. For example, it would be nice if there could be a registered
log
function, that automatically uses theLOGGER
.The text was updated successfully, but these errors were encountered: