Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Documents Playdate SDK Lua patterns: global modules, imports, pdxinfo structure, and on-device vs desktop Lua 5.4 differences.
72% 100%+28 ptsof test cases passed
Passed 25 of 25 test cases with the skill, and 18 of 25 without it.
3 of 3 safety checks passed
17 agent runs
1 forkA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
Playdate games run Lua 5.4 on-device via the Playdate SDK runtime. The same Lua 5.4 interpreter runs on desktop for unit tests, but the playdate.* API is absent on desktop.
Key consequence: never call playdate.* APIs in models or systems. Those modules must be importable and testable on desktop Lua without a simulator.
The Playdate SDK uses import (not require). Imported modules declare a global table:
-- src/models/Actor.lua
Actor = {}
Actor.__index = Actor
function Actor.new(def)
local a = setmetatable({}, Actor)
a.name = def.name
a.maxHP = def.maxHP
a.hp = def.maxHP
return a
end
function Actor:isDead()
return self.hp <= 0
end
Callers reference the global directly after import:
import "models/Actor" -- declares global Actor
local hero = Actor.new(PARTY_DATA.player)
import resolves relative to the project src/ root (the path passed to pdc)Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.