Skip to content
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

Runtime error #13

Open
notdanilo opened this issue Feb 24, 2024 · 16 comments
Open

Runtime error #13

notdanilo opened this issue Feb 24, 2024 · 16 comments

Comments

@notdanilo
Copy link
Contributor

notdanilo commented Feb 24, 2024

Any plan to continue development?

@Fireboltofdeath
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

Fireboltofdeath commented Feb 24, 2024

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
Copy link
Contributor Author

I did it and I got a new error
image

@notdanilo notdanilo changed the title Any plan to continue development? Runtime error Feb 24, 2024
@notdanilo
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

notdanilo commented Feb 24, 2024

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

@notdanilo
Copy link
Contributor Author

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
Copy link
Contributor Author

notdanilo commented Feb 24, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

rust-lang/cargo#3808

notdanilo added a commit to sensorial-studio/roblox-bindings that referenced this issue Feb 24, 2024
@Fireboltofdeath
Copy link
Member

Fireboltofdeath commented Feb 25, 2024

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

Fireboltofdeath commented Feb 25, 2024

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
Copy link
Contributor Author

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

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