Questions tagged [pico-8]

Pico-8 is a virtual machine and fantasy console for making, sharing and playing tiny games. Users create "cartridges" through a Lua-based environment.

Here is the Pico-8 homepage: https://www.lexaloffle.com/pico-8.php

16 questions
3
votes
1 answer

Pico-8 coroutines are occasionally dead

I was trying to replace a for-loop with coroutines to move the stars: --fine function _update() for c in all(boids) do move_boid(c) end end --broken function _update() for c in all(boids) do coresume(cocreate(move_boid),c) end end Notice…
knh190
  • 2,338
  • 1
  • 12
  • 27
3
votes
1 answer

Deserialization of simple Lua table stored as string

I'm transfering a lua table literal in a string from a web application in to PICO-8 that I'm trying to deserialize back in to a lua table in PICO-8. The string is in the form '{"top", {"one", {"one a", "one b"}}, {"two", {"two a", "two b"}}}' To try…
K Groll
  • 468
  • 1
  • 8
  • 16
2
votes
1 answer

Lua)) how to loop table of table and get a specific property?

I am really newbie in lua. I have this lua code local gun_info = { g_sword={rate=0.5;spd=0;dmg=1;ammo=1;}; g_pistol={rate=0.5;spd=5;dmg=1;ammo=40;}; g_knife={rate=0.8;spd=5;dmg=1;ammo=1;}; g_shuriken={rate=0.3;spd=5;dmg=1;ammo=40;}; …
2
votes
1 answer

Modifying a Linked List With a Function in Lua

My question is regarding the below code snippet: function add_node(list, v) list={next=list, val=v} end function print_linked_list(list) local l=list while l do print(l.val) l=l.next end end root=nil root={next=root, val=0} add_node(root,…
Colin
  • 23
  • 4
2
votes
1 answer

IF ELSE IF END gives Unclosed Function error

I am looking at PICO-8 for the first time. This simple IF statement give me the error "UNCLOSED FUNCTION AT LINE 1". function MYTEST() local x = 1 if x==1 then print("x==1") else if x==0 then print("x==0") end end I admit the…
rodoherty1
  • 527
  • 3
  • 12
1
vote
1 answer

Wrong variable update in PICO-8

I was building a simple snake game from scratch as practice for PICO-8 and Lua. I'm attempting to have the body follow the head by creating a copy of the old body locations and update along the length. I created a t_old variable to store the…
1
vote
0 answers

Buildroot for pico-8 on raspberry pi0w keyboard input issue

I have been tinkering around with buildroot to try to put together an image with wifi and ssh support and is able to run Pico-8. I'm really close and have everything running successfully, but Pico-8 is not accepting keyboard inputs. I'm sure it's…
itsonlym3
  • 11
  • 2
1
vote
1 answer

PICO-8 making a button press show an output of text only once?

I'm a complete newbie to both Lua, PICO-8, and coding in general. I'm having trouble with a function I want to put in my first program. The text is all placeholder, I will change it once I get the code right and comprehend it. Basically, before the…
B. Hoyt
  • 13
  • 4
0
votes
1 answer

Lua equivalent of dictionary.get() method?

How do I access a dictionary using a parameter? In python I can do dictionary.get(param) Is there an equivalent to this in lua? I want to do something like this: function make_object_from_flag(x, y, flag) local flag_obj = { [1] =…
0
votes
1 answer

Raycasting bends the World wierdly. PICO-8. (LUA)

I am trying to make a Wolfenstein3D-like game, using pico-8 (that's a 2d engine with many limitations) and the world just bends very weirdly. Gif of running around My code: (Warning LUA! Confusing language. starts counting at 1...! ) function…
Nizart
  • 1
  • 1
0
votes
1 answer

PICO-8 Export Command in a GitHub CI/CD Pipeline

I'm working a small PICO-8 game that I am embedding into my website. There's an export command I use to create the game files for the web player, but I can only run this command locally in the PICO-8 application. Is there any support to run this…
greg
  • 830
  • 12
  • 30
0
votes
1 answer

Coding error in Pico 8 code (lua). (Newbie here)

I have recently started coding and wanted to try out Pico-8. A game development platform that uses Lua. I watched tutorials on how to create a platformer and have run into an obstacle with my code. Spid in the code is the name of my main sprite and…
Pterrible
  • 11
  • 2
0
votes
1 answer

Html issue Iframe,Canvas

I use this gameengine pico8 and you can export a html version of your game. I put it in on my website but now every other iframe frome my website isn´t working the way it should anymore i guess the code from pico8 messed something up but im not…
Delidragon
  • 159
  • 16
0
votes
0 answers

Attempt to index local (a number value)

sorry for the dumb question, but I'm new to programming On run this code i'm get error: attempt to index local (a number value) This part of code! function simple_haunt_ai(mon,m) --constructor if m.typ=="walker" then for m in all(mon)…
no_name
  • 1
  • 1
-1
votes
1 answer

lua, iterating and calling all same-named-functions of n=3 tiers of tables

Say I have multiple tables in {game} like {bullets}, where {bullets} has multiple tables as found below. How would I iterate through and call all the update functions contained in {game}? --Below is a simplified example, Assume each table in…
kite
  • 254
  • 1
  • 9
1
2