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

A game built without --device running on device tries to run the Lua playdate.update #74

Open
paulyoung opened this issue Oct 15, 2023 · 1 comment

Comments

@paulyoung
Copy link
Contributor

paulyoung commented Oct 15, 2023

I’m not sure if this is a bug but it might be worth documenting if not.

I made a PR with some changes that allow interacting with the Lua runtime. I had to define an empty main.lua file and add the resulting main.pdz file to assets in Crank.toml or I got an error about main.pdz being missing when running in the simulator, but otherwise everything worked great.

(I’m now wondering if that’s even necessary if I build with --device and will try that later, see below)

As explained in this dev forum post; if I build with crank build and then upload via the simulator, something tries to call playdate.update in Lua. This obviously doesn’t exist, but if I define it in main.lua the function gets called.

If I build with crank build --device and upload to device via the simulator, my Rust update function gets called.

For what it’s worth, I’m uploading to device via the simulator because crank run --device hangs (#41 (comment))

@paulyoung
Copy link
Contributor Author

I suppose this may actually belong in the crank repo, but I'll follow up here anyway.


I had to define an empty main.lua file and add the resulting main.pdz file to assets in Crank.toml or I got an error about main.pdz being missing when running in the simulator, but otherwise everything worked great.

(I’m now wondering if that’s even necessary if I build with --device and will try that later, see below)

I just tried this and it is necessary. --device makes no difference.


As explained in this dev forum post; if I build with crank build and then upload via the simulator, something tries to call playdate.update in Lua. This obviously doesn’t exist, but if I define it in main.lua the function gets called.

If I build with crank build --device and upload to device via the simulator, my Rust update function gets called.

The opposite appears to be true as well. If I do crank build --device and open the resulting .pdx in the simulator, I get a no such function 'update' error because something is trying to run a Lua playdate.update function. If I go to Device > Upload Game to Device the Rust update function runs on the device and things work as expected.

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

1 participant