Skip to content

No direct way to set ruby function/variables within javascript. #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Drago-Cuven opened this issue May 16, 2025 · 3 comments
Open

No direct way to set ruby function/variables within javascript. #596

Drago-Cuven opened this issue May 16, 2025 · 3 comments

Comments

@Drago-Cuven
Copy link

Looking through the docs, I expected to be able to find a way to directly set a variable and/or function to ruby in javascript using something like vm.set() like some high quality vms like pypy and wasmoon do but seeing that isnt the case that leavs me wondering how exactly can i do so? This features is pretty important for my project seeing as its how i need this to set a library of commands up to work.

@kateinoigakukun
Copy link
Member

kateinoigakukun commented May 17, 2025

Hi @Drago-Cuven, thanks for opening this issue!

To help us better understand your needs, could you share what kind of API or interface you would ideally like to see for setting Ruby variables or functions from JavaScript?
Thanks!

@Drago-Cuven
Copy link
Author

Drago-Cuven commented May 17, 2025

Ok, sorry for being so vague. I know that ruby doesn't exactly have functions, but methods in ruby are pretty close either way. i'm hoping that we can set variables and methods from ruby to variables and functions from javascript simar to the way the pypy and wasmoon VMs APIs work. In wasmoon you can see a direct example right there in the readme: "lua.global.set('sum', (x, y) => x + y)" i can imagine ruby.wasm's api working similarly with something like "vm.set('sum', (x, y) => x + y)" or "vm.setMethod('sum', (x, y) => x + y)" where set is just used for setting a variable from js. vm.get would obviously work in reverse.

Just in case you need context for what i'm trying to use these features for, here is a link to my repository.

https://github.com/Drago-Cuven/Dragonian-Extensions/tree/main/Written-Code-4-Scratch-Mods

@Drago-Cuven
Copy link
Author

@kateinoigakukun ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants