Playdate.datastore boolean error

I'm using PlayDate SDK v1.12.0 on Windows with the simulator.
When I read a boolean with "", if the boolean is true, works fine.
But, if the boolean is false, the returned value is "nil" (Need to be false).

Strange. This is working as expected for me:

import "CoreLibs/object"

a = { this=false, that=true }
playdate.datastore.write(a, "test")
b ="test")

function playdate.update() end


	[that] = true,
	[this] = false,

I'm on a Mac but I don't expect that would make any difference. Does the above also drop the false value for you?

1 Like

Okay, found the problem, I was using this code to check if the value existed :

-- Data is the result
-- Name is the name of the value
if data[name] then
    return data[name]
    return nil

But when data[name] was false, the program returned null

Now I'm using :

return data[name]

No more useless checks

Thank you !

1 Like