Help running the single file examples

I've been playing around with the example files that came with the SDK. I'm able to get all of them to work except for the single file examples.

I'm trying to use the crank example file.
I tried coping the file into my project, then do import crank, but it doesn't seem to work.

Looking at other examples it has when they use a file they typically use something like
Crank = {}

Crank.__index = Crank

Which I tried too, but also couldn't get it to work.
I've looked at the Playdate doc and Lua home page, but lua modules seem to always want require and that doesn't seem work either.

I'm just running around in circles at this point, and could use some help.

The single-file examples are meant to be run standalone. Make a new project, grab an example file, rename it to main.lua, and try running that.

If that doesn’t work for you, let us know exactly what happens—in what way does it not work?

I believe (at least the last time I checked) there is a main.lua file that includes all of the examples, just uncomment the file you want to try.

1 Like

Ok, yes it does run if I rename it main.lua. I was thinking I had to call it from my main.lua file and that is where I was getting hung up.