bindings icon indicating copy to clipboard operation
bindings copied to clipboard

Runtime error

Open notdanilo opened this issue 1 year ago • 17 comments

Any plan to continue development?

notdanilo avatar Feb 24 '24 03:02 notdanilo

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.

Fireboltofdeath avatar Feb 24 '24 03:02 Fireboltofdeath

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

notdanilo avatar Feb 24 '24 03:02 notdanilo

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

Fireboltofdeath avatar Feb 24 '24 03:02 Fireboltofdeath

I did it and I got a new error image

notdanilo avatar Feb 24 '24 05:02 notdanilo

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 avatar Feb 24 '24 05:02 notdanilo

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 avatar Feb 24 '24 05:02 notdanilo

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

notdanilo avatar Feb 24 '24 05:02 notdanilo

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 avatar Feb 24 '24 21:02 notdanilo

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 avatar Feb 24 '24 22:02 notdanilo

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 avatar Feb 24 '24 22:02 notdanilo

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

notdanilo avatar Feb 24 '24 22:02 notdanilo

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 avatar Feb 25 '24 00:02 Fireboltofdeath

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.

Fireboltofdeath avatar Feb 25 '24 00:02 Fireboltofdeath

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?

notdanilo avatar Feb 25 '24 01:02 notdanilo

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.

Fireboltofdeath avatar Feb 25 '24 01:02 Fireboltofdeath

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)?

notdanilo avatar Feb 25 '24 02:02 notdanilo

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.

kerosina avatar Aug 22 '24 18:08 kerosina