Log In  


Hi everyone a quick question. I am following the official Lua language from the 5.4 version. The book is only 300 pages long.

How much Lua do I actually need to know to get started developing games with Pico-8?



Well I started with ~0 and then had lots of failure, but it's also something you just learn as you do it
I would say if you get the gist of variables and pico's api you'll be good to start.. scopes, tables, bitwise stuff, that could wait.. maybe.. though understanding scopes and tables is huge


I started about a month and a half ago with no prior knowledge, although I had some prior coding experience (mainly text parsing and shell scripting). I've already learned enough to make my own rudimentary compression scheme, work with memory, use bitwise functions and a bunch of other stuff I never thought I would learn.

I haven't read the manual all the way through and I only watched enough youtube tutorials at the start to understand the basic program structure. I just keep the manual and the API Reference page on the wiki open while I work and look at whatever functions I think I might need to use. You don't need to learn them all at once, only the ones that you need for what you're currently trying to do. Later on you'll find better ways to do things.


TL;DR

I think understanding the Pico-8 user manual (sections 4 through 6 inclusive) is enough to get started.

Lua and Pico-8 seem to do things slightly differently in some areas.


Intro

I hadn't programmed in Lua before, but could program.

I am going to supply an answer that covers both what relatively new programmers might need, and what people who can already program but don't know Lua might benefit from.

For easy reference purposes, there are links throughout to the Pico-8 user manual and Programming In Lua.


Online book: Programming In Lua

A book such as Programming In Lua (PIL) contains information on things that are not implemented in Pico-8. In my opinion, to get started programming games with Pico-8, for information on types and flow control (the basics of a language), reading something like PIL is not necessary for someone who can already program, but would probably benefit someone relatively new to programming. However, for someone relatively new to programming, reading PIL may also confuse them when Pico-8 lacks features that Lua has, or uses its own functions for features which Lua implements slightly differently.

For relatively new programmers, chapters 1 through 5 of PIL should be enough to get started with Pico-8. These cover:

1 Getting Started

2 Types and Values

3 Expressions

4 Statements

5 Functions

Other chapters can then be read when further explanation is needed of a command that Pico-8 is using.

Someone reading PIL (or a similar book/reference) for use with Pico-8 should keep in mind that not everything in one is in the other.


Pico-8 User Manual

For people who can already program, reading the manual through should be enough for all the types, flow control, and operations on numbers, strings, booleans, and tables, as well as working with sprites etc. These are similar in the programming languages and libraries for games that I have used (not so many), and I expect others will find the same. Nevertheless, while using Pico-8 it can be useful to keep a copy of the manual open for commands and syntax that have slipped your mind.

In my opinion an understanding of what the manual says in sections 4 through 5 (inclusive) and most of section 6 is enough to get started developing games with Pico-8.

To be clear, those sections cover:

4 Lua Syntax Primer

5 Pico-8 Program Structure

6.1 System

6.2 Graphics

6.3 Tables

6.4 Input

6.5 Audio

(Sections 6.6 Map and 6.7 Memory aren't essential when starting out.)

6.8 Math

(Section 6.9 Custom Menu Items isn't essential when starting out.)

6.10 Strings and Type Conversion

(Sections 6.11 through 6.14 aren't essential when starting out.)

Section 2.4 SFX Editor is also useful to know.

The sections I have said aren't essential when starting out, can become essential for some operations such as saving high scores, so should eventually be given a read anyway.


Slightly more advanced Lua topics

I didn't find the manual sufficient to cover some of the other aspects of Lua. None of these (see final paragraph) are essential for someone to get started programming games in Pico-8; anyone relatively new to programming shouldn't concern themselves with these initially (although an understanding of the concept of object oriented programming is always good to have).

If you already program, but aren't familiar with Lua, these are probably the chapters of PIL to give some time to reading.

For some of the details of coroutines and everything about how to use metatables I read the online version of Programming in Lua. It's also worth reading if you want to know how Lua handles object oriented programming or what you can do with functions in Lua, as well as a few other topics.


I had programming knowledge but had never so much as looked at Lua prior to PICO-8. In my experience, you can definitely jump right into PICO-8. Like @SmellyFishstiks said, you'll try and fail a lot, then you'll look up why something might not be working or post some code snippets here, the community will help you work through it, and you'll learn & make progress that way. The various tutorials from @Krystman and @MBoffin on Youtube, concept demo carts here, and game source code from the thousands of games posted here will also be much more valuable than the Lua manual, IMO.


Note that pico8’s language is lua 5.2 with a few additions.



[Please log in to post a comment]