Skip to content
DuckAfire edited this page Jan 21, 2024 · 9 revisions

Tiny Library

This is a "Libraries Collection" created to facilitate the creation of games (cartridges) for the fantasy computer/console Tic80. Through the use of sets of simple functions (library). All the libraries of this collection have two variants, they are it: Compacted and Not Compacted.


How to use/active the libraries

The easiest way to use libraries inside Tic80 is by copying and pasting them to your cartridge, because this method works in all cartridge formats (.tic, .exe, ...). But this method may not work if the libraries are not structured for use like this.



Conventional structure (!lua)

local lib = {}

local function msg( txt )
    print( txt )
end

lib.msg = msg

return lib


Internal structure


local LIB = {}

do
    local function msg( txt )
        print( txt )
    end

    LIB.msg = msg
end

local lib = LIB

local LIB={}
do LIB.msg=function(t) print(t) end end
local lib=LIB


  • Remember: There are different ways to structure a library, but both follow a certain pattern.