roblox-rs / bindings

Rust bindings for the Roblox standard library.
https://github.com/Rerumu/Wasynth
MIT License
44 stars 5 forks source link

Runtime error #13

Open notdanilo opened 8 months ago

notdanilo commented 8 months ago

Any plan to continue development?

Fireboltofdeath commented 8 months ago

I plan to continue development eventually, yes.

roblox-rs uses https://github.com/Rerumu/Wasynth to compile the WebAssembly into Luau code, and Wasynth is currently undergoing some major changes that will make its emit a lot faster and more viable in real world usage.

After the new version of Wasynth is out, I'll likely try and find some more time to dedicate to roblox-rs.

notdanilo commented 8 months ago

Sounds good! It isn't working right now. Any chance you can support me? If I get it working, I might contribute to the project.

image

Fireboltofdeath commented 8 months ago

You'll need to copy this file from Wasynth and paste it into roblox/runtime.lua, since it has not been updated to use buffers

https://github.com/Rerumu/Wasynth/blob/trunk/codegen/luau/runtime/runtime.lua

notdanilo commented 8 months ago

I did it and I got a new error image

notdanilo commented 8 months ago

First of all, I am new to Lua. I don't see where Integer is initialized, so I assumed that Integer was a language standard object. But it's nil. Why?

https://github.com/Rerumu/Wasynth/blob/d6b7a232ac31fcc66330109f19317d6df39ceebe/codegen/luau/runtime/runtime.lua#L1-L9

notdanilo commented 8 months ago

I see that Integer is defined in runtime.luau. I removed runtime.luau from the same folder thinking that it would conflict with runtime.lua. Do they both need to exist?

notdanilo commented 8 months ago

I got it to work by copying the definition of Integer in runtime.luau to runtime.lua :)

notdanilo commented 8 months ago

I made it work once, but now, with no obvious change made, I am getting this error. I've tried for many hours to reproduce every step to make it work again with no success. Any idea what is going on here?

image

notdanilo commented 8 months ago

My initial attempt was to try to copy everything in the roblox folder to rojo's default project src/server folder. I have no idea how I got it to work. But I realized I have to use bindings rojo's project to make it work. And run the README.md steps using bindings as the working dir.

notdanilo commented 8 months ago

So, in order to make it work I had to:

  1. Copy runtime.lua from Wasynth
  2. Copy the Function definition from runtime.luau to runtime.lua
notdanilo commented 8 months ago

The last error I got was possibly happening because the rustflags in .cargo/config where missing when using cargo build --manifest-path. Also .cargo/config is deprecated in favor of .cargo/config.toml. I wonder if updating it will make it work.

https://github.com/rust-lang/cargo/issues/3808

Fireboltofdeath commented 8 months ago

The last error I got was possibly happening because the rustflags in .cargo/config where missing when using cargo build --manifest-path.

I'm not sure what you mean by this, what path are you specifying for the manifest?

EDIT: oh, it's a Rust bug. Switching to config.toml probably won't fix that

Fireboltofdeath commented 8 months ago

I see that Integer is defined in runtime.luau. I removed runtime.luau from the same folder thinking that it would conflict with runtime.lua. Do they both need to exist?

Only one needs to exist, but we name the file .luau as that is the language that Roblox uses.

Integer is defined separately in Wasynth as there's two implementations, the table-based version (faster) and the vector-based version (more memory efficient.) I believe roblox-rs is using the vector-based one, but you can use either technically.

notdanilo commented 8 months ago

Integer is defined separately in Wasynth as there's two implementations, the table-based version (faster) and the vector-based version (more memory efficient.) I believe roblox-rs is using the vector-based one, but you can use either technically.

I still don't get how it's included and why I have to write it on top of the runtime.lua file. Is there something I am missing?

Fireboltofdeath commented 8 months ago

Integer is defined separately in Wasynth as there's two implementations, the table-based version (faster) and the vector-based version (more memory efficient.) I believe roblox-rs is using the vector-based one, but you can use either technically.

I still don't get how it's included and why I have to write it on top of the runtime.lua file. Is there something I am missing?

It's the 64 bit integer implementation. Lua(u) doesn't have 64 bit integers but wasm requires them so they're implemented manually. It's not in the same file by default as there's two implementations (one favors memory, the other favors performance.)

That said, all of that will be significantly simplified in Wasynth's refactor, and I believe the latest version actually exports the runtime so roblox-rs could switch to that instead of copying the runtine manually.

notdanilo commented 8 months ago

I get this, my question was mostly about: Do I really need to copy the Integer implementation in the runtime.lua file? Or is there a correct way to do include it (or maybe a project config I am missing)?

kerosina commented 2 months ago

I made it work once, but now, with no obvious change made, I am getting this error. I've tried for many hours to reproduce every step to make it work again with no success. Any idea what is going on here?

image

I fixed the getservice error by disabling multivalue.