What do I need to run LUA code on the playdate simulator

I am using the Windows version of the SDK.

I have VScode and the SDK downloaded. I am coding in a LUA file and am wanting to run that code on my Playdate simulator. I believe I need to run PDX files in the simulator I am not sure how to turn my LUA code into that format.

I have attempted to create a PDX file in VScode and then copy and paste my LUA code into it and run that on the simulator but I had no luck.

Hope that makes sense and you can help me.

Have you to get the code running in the simulator yet? If not, here is how you do it:

  1. First you need to add ‘PLAYDATE_SDK_PATH’ to your environment variables:
    • Search for ‘Edit environment variables for your account’ in the windows search bar.
    • Press new and set name to ‘PLAYDATE_SDK_PATH’ and value to ‘C:\PATH\TO\PlaydateSDK’

  2. After that you should add SDK bin folder to your path.
    • Again, search for ‘Edit environment variables for your account’ in the windows search bar.
    • Click the variable ‘Path’ and press edit
    • Press new and set the value to ‘C:\PATH\TO\PlaydateSDK\bin’

  3. Now you can build any playdate lua project in the command line by using the command:

    pdc ‘path\to\game\source’ ‘path\to\game\output’
    

    This creates a folder at the output path with the extension ‘.pdx’. You can just drag this into the simulator to play the game or press file, open and then locate the .pdx folder.

If you want to be able to quicly build withing VScode by pressing f5 there is an extension called ‘Playdate’. With this installed you only need to press f5 to compile and launch the game in the simulator, if everything is set up correctly.

Note there is a spelling mistake in your command. The tool to compile projects is pdc, not pdx

1 Like