Update - Figured it out.
I wasn't in the right file in vscode when I said 'run'.
Leaving this here in case it can help others.
Finally got playdate in and running through SquidGod's tutorials.
Hit a weird issue that I'm not sure if this is my misunderstanding of Lua or something else.
Using Windows.
Basically I'm doing an import of a script that exports a module.
In another script I'm trying to access this module, but it is Nil. That is unless I access it with like print() before I import the next script.
Code example below.
This code below does not work.
when it gets to ldtk.load("levels/world.ldtk", false)
the debug console reports ldtk is nil.
But if I uncomment print(LDtk)
in main.lua it starts to work
Very confused any guidance would be appreciated.
main.lua
import "CoreLibs/object"
import "CoreLibs/graphics"
import "CoreLibs/sprites"
import "CoreLibs/timer"
-- Libraries
import "scripts/libraries/LDtk"
-- Game
-- print(LDtk) - by being commented out the code fails, if uncommented the code works
import "scripts/gameScene"
local pd <const> = playdate
local gfx <const> = playdate.graphics
-- GameScene()
function pd.update()
gfx.drawText("Hello World", 100,100);
gfx.sprite.update()
end
scripts/gameScene.lua
local gfx <const> = playdate.graphics
local ldtk <const> = LDtk
ldtk.load("levels/world.ldtk", false)