As part of a project I'm working on, I wrote a quick json parser that loads a json file into a picotron table and thought it might be worth sharing.
E.g.
{
"a":{"b":1,"c":-3.5},
"d":["e",true,false]
} |
is converted to:
{
a={
b=1,
c=-3.5
},
d={"e",true,false}
} |
So if you have some data in json format already, it's easy enough to load in. Hopefully a bit useful for storing configurations or data needed by carts outside of the code itself for neatness.
It should follow json specifications (e.g. whitespace outside of strings doesn't matter), and any null values will be handed as picotron's nil - however, because of the ways nils are added to tables, they won't work/appear in the way it does in the json itself.
Also, if the parser runs into any issues, it tries to offer some helpful errors to identify where the problem is.
I've done some light testing of the code, but let me know if you run into any issues with it.
Code is hidden below:
[hidden]
function init_json_reader()
J_WHITESPACE = {}
J_WHITESPACE[" "]=true
J_WHITESPACE[" "]=true
J_WHITESPACE[chr(10)]=true
J_WHITESPACE[chr(13)]=true
J_START_TABLE = "{"
J_STOP_TABLE="}"
J_START_LIST="["
J_STOP_LIST="]"
J_QUOTE="\""
J_COLON=":"
J_COMMA=","
J_OBJ_STARTS={
n=read_json_null,
t=read_json_true,
f=read_json_false,
}
J_OBJ_STARTS[J_QUOTE]=read_json_key_string
J_OBJ_STARTS[J_START_TABLE]=read_json_table
J_OBJ_STARTS[J_START_LIST]=read_json_list
J_OBJ_STARTS["-"]=read_json_number
for i = 0,9 do
J_OBJ_STARTS[tostr(i)] = read_json_number
end
json_init = true
end
function load_json_file(filepath)
-- Load and read a json file and return a list or table
if not json_init then init_json_reader() end
local text = fetch(filepath)
assert(text!=nil,"Failed to load json file: "..filepath)
return read_json(text)
end
function read_json(string)
if not json_init then init_json_reader() end
-- Read a json string and return a list or table.
if #string == 0 then
return nil
end
local i=skip_json_whitespace(string,1)
if string[i] == J_START_TABLE then
return read_json_table(string,i)
elseif string[i] == J_START_LIST then
return read_json_list(string,i)
else
assert(false,"Unexpected initial character encountered in json file: "..string[i])
end
end
function skip_json_whitespace(string,i)
-- Skip to the first non-whitespace character from position i
while J_WHITESPACE[string[i]] do
i+=1
assert(i<=#string,"Unexpectedly hit end of file while skipping whitespace\nin json file")
end
return i
end
function read_json_table(string,i)
local eot = false
local tab = {}
local k, v = nil, nil
if string[i]==J_START_TABLE then
i+=1
end
while not eot do
k, v, i = read_json_table_entry(string, i)
tab[k] = v
i = skip_json_whitespace(string,i)
if string[i]==J_COMMA then
i+=1
elseif string[i]==J_STOP_TABLE then
i+=1
eot=true
else
assert(
false,
"Unexpected character encounted after reading json entry with\nkey '"..tostr(k).."': "..tostr(string[i]).." "
)
end
end
return tab, i
end
function read_json_table_entry(string, i)
local k, v = nil, nil
i = skip_json_whitespace(string,i)
k, i = read_json_key_string(string,i)
i = skip_json_whitespace(string,i)
assert(
string[i] == J_COLON,
"Expected colon following json key '"..k.."', found: "..string[i]
)
i = skip_json_whitespace(string,i+1)
assert(
J_OBJ_STARTS[string[i]]!=nil,
"Unexpected value encounted while reading json entry\n'"..k.."', found: "..string[i]
)
v,i=J_OBJ_STARTS[string[i]](string,i)
return k, v, i
end
function read_json_key_string(string,i)
assert(
string[i]!=J_STOP_TABLE,
"Table ended while expecting entry, make sure you don't have a misplaced comma."
)
assert(
string[i]==J_QUOTE,
"Expected json key/string to start with double quote,\ninstead found: "..sub(string,i,i+10).."..."
)
i+=1
local s = i
while string[i]!=J_QUOTE do
i+=1
assert(
i<=#string,
"Encountered end of json while reading key/string:\n"..sub(string,i,i+10).."..."
)
end
return sub(string,s,i-1), i+1
end
function read_json_list(string, i)
local eol = false
local lis = {}
local value = nil
if string[i]==J_START_LIST then
i+=1
end
while not eol do
i = skip_json_whitespace(string,i)
assert(
string[i]!=J_STOP_LIST,
"List ended while expecting entry, make sure you don't have a misplaced comma."
)
assert(
J_OBJ_STARTS[string[i]]!=nil,
"Unexpected value encounted while reading json list,\nfound: "..sub(string,i,i+10).."..."
)
value,i=J_OBJ_STARTS[string[i]](string,i)
add(lis,value)
i = skip_json_whitespace(string,i)
if string[i]==J_COMMA then
i+=1
elseif string[i]==J_STOP_LIST then
i+=1
eol=true
else
assert(
false,
"Unexpected character encounted after reading json list entry: "..string[i]
)
end
end
return lis, i
end
function read_json_null(string,i)
assert(sub(string,i,i+3)=="null","Was expecting to read null during json file read, instead\nfound: "..sub(string,i,i+10).."...")
i+=4
return nil, i
end
function read_json_true(string,i)
assert(sub(string,i,i+3)=="true","Was expecting to read true during json file read, instead\nfound: "..sub(string,i,i+10).."...")
i+=4
return true, i
end
function read_json_false(string,i)
assert(sub(string,i,i+4)=="false","Was expecting to read false during json file read, instead\nfound: "..sub(string,i,i+10).."...")
i+=5
return false, i
end
function read_json_number(string,i)
local s = i
while not (
J_WHITESPACE[string[i]] or
string[i]==J_COMMA or
string[i]==J_STOP_TABLE or
string[i]==J_STOP_LIST
) do
i+=1
assert(i<=#string,"Unexpectedly hit the end of json string while reading a number.")
end
return tonum(sub(string,s,i-1)), i
end |

How to Play
Use the mouse to connect 3 or more adjacent gems of the same color (horizontal and vertical connections only). There are 2 modes, Normal and Timed. In normal mode, the goal is to clear 100 gems to finish the game. In timed mode, the goal is to clear as many gems as possible within 60 seconds.
Scoring
In normal mode, the ending pop-up shows how much time it took to clear 100 gems. In timed mode, the ending pop-up shows how many gems were cleared within 60 seconds. Please share your score screenshot as a comment! :)
Dev Notes
This is my very first game for PICO-8 and my very first project that is open source. Feedback and suggestions about the game and the source code are greatly appreciated as I am eager to grow and learn. Thank you!

What Is It Like to Be a Bubble?
A meta-interrogation of the physiological patterns, intra-structural semantics, and conscious fabrics of nothingness pockets.
With BULLET HELL ACTION🔥🔥🔥
A game by Team Peaceful Bubble for Global Game Jam 2025. Made at the Let's Games! Tokyo site in Tokyo, Japan.
Credits
@acedio - Programming
@douglasdriving - Programming, Writing
@kitasuna - Programming, Level Design
@mabbees - Programming, Music
Shane - Art

Guide your cactus to the skies, being careful to maintain enough water and enough air to stop the bubble bursting.
Uses left and right arrow keys to move (keyboard) or d-pad(controller)
Tap x (keyboard) or a/x (xbox or ps controller) to spend resources to move upwards
Use x (keyboard) or a/x (xbox or ps controller) to start/replay
How high will you get?
Made for Global Game Jam 2025 "Bubble"

🇧🇷
um joguinho simples de cara ou coroa que eu fiz! o código é bem curto, então se você for brasileiro e estiver começando, espero que isso ajude de alguma forma!
🇨🇳
a simple little game of heads or tails i made! the code is very short, so if you're brazilian and just starting out, i hope this somehow helps!
disclaimer: i don't know the rules of language in the forums, but please let me know if I infringed any of them and i'll gladly update my post!
observed: a function definition in which there's a line break between the function keyword and the name will not be visited when using alt+up and alt+down
expected: it will jump to the line with function on it
i use this convention to maximize the space i have for writing parameter lists so that i don't have to scroll horizontally, and to me this is the most aesthetically pleasing place to insert a line break
TJ: OH MY GOD GAL THE GGJ WAS TODAY!
GAL: What?
TJ: THE GLOBAL GAME JAM! I overslept! God! I need the prize money we gotta GO GO GO.
GAL: Prize money? what the hell are you going on about?
TJ: THE PRIZE MONEY! To cover my severe gambling debt!
GAL: Gambling debt?
TJ: OK, here's the deal, let's just give the prompt theme to ChatGPT and see what comes-
GAL: It's already done.
TJ: What? ChatGPT did it that fast?
GAL: No. We've been working on this thing for 2 days. You just slipped and fell on the way to make coffee and I think you have a concussion.
TJ: That would explain why everything is purple...
Hi everyone! We made this! It's a game where YOU get to be the AI.
So... i may have made a Rom hack of "Jelpi Extended" by NOTCL4Y... which is a hack of the original Jelpi demo...
Here it is i guess
that's all, bye, have fun.
ok fine, description.
-STORY-
Some Flying Centipede things is attacking Jokyo City, but that city is for you to destroy, not them, so kill em'!
-CONTROLS-
...you can guess...there's like 2 buttons and a d-pad, so figure it out yourself.
-ITEMS-
|
|
[8x8] |
Introduction
Mary Raleigh (Dr. Roly Poly), a whimsical professor of robotics engineering, has developed a game to teach her students concepts in automation. The aim of the game is to guide a marble through a maze using only a small set of context-based rules. You can try to solve the various challenges she’s devised or make your own!
Control Terminology
Term................controller / keyboard / mouse
Navigation..........d-pad / arrow keys / mouse
Primary button......O button / Z or C key / left mouse button
Secondary button....X button / X or V key / right mouse button
Menu button.........options button / enter key / middle mouse button
Quick Guide
The main game is a series of challenges available from the main menu. Open challenges will appear with a name and illuminated preview. Simply press the primary button to play it. Completing unfinished levels will unlock new ones.

Rules
You have 10 roll attempts to match the current target. If you succeed you win Points!
Try to gain as many points as you can!
If you exceed 10 rolls you will lose points and the target will be reset
Controls
Left and Right to move the cursor
Button O to roll all dice
Button X to roll selected dice
Up button to reset Target. Deducts 5 points.





3 comments

