TIC-80 API一覧
TIC-80のプログラムを作る際に、APIの書式を確認したくなることが多かったので、公式Wikiから抜き出して一覧化してみました。主に自分向けです。
コマンド
add
cd <dir>
cls
config [save | default]
del <file>
demo
dir
edit
exit
export [html | native | sprites | cover | map]
folder
get <file>
help
import [sprites | cover | map]
keymap
load <cart> [sprites | map | cover | code | sfx | music | palette]
mkdir
new [lua | moon | js]
ram
resume
run
save <cart>
surf
version
コールバック
TIC()
scanline(line)
API
btn([id: 0..5 8..13]) -> pressed
btnp([id: 0..5 8..13, [hold period]]) -> pressed but wasn't pressed in previous frame
clip([x, y, w, h])
cls([color])
circ(x, y, radius, color)
circb(x, y, radius, color)
exit()
font(text, x, y, colorkey, char_width, char_height, fixed, scale) -> width
line(x0, y0, x1, y1, color)
map([x=0, y=0], [w=30, h=17], [sx=0, sy=0], [colorkey=-1], [scale=1], [remap=nil])
memcpy(toaddr, fromaddr, len)
memset(addr, val, len)
mget(x, y) -> id
mouse() -> x, y, pressed
mset(x, y, id)
music([track=-1], [frame=-1], [row=-1], [loop=true])
peek(addr) -> val
peek4(addr4) -> val4
pix(x, y, [color]) -> color
pmem(index:0..6, [val]) -> val
poke(addr, val)
poke4(addr4, val)
print(text, [x=0, y=0], [color=15], [fixed=false], [scale=1]) -> width
rect(x, y, w, h, color)
rectb(x, y, w, h, color)
sfx(id, [note], [duration=-1], [channel=0], [volume=15], [speed=0])
spr(id, x, y, [colorkey=-1], [scale=1], [flip=0], [rotate=0], [w=1, h=1])
sync([toCart=true])
time() -> ticks elapsed from game start
trace(msg, [color])
tri(x1, y1, x2, y2, x3, y3, color)
textri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3, [use_map=false], [chroma=-1])
Lua標準ライブラリ
_G
_VERSION
assert(v, [message])
collectgarbage([opt, [arg]])
dofile([filename])
error(message, [level])
getmetatable(object)
ipairs(t)
load(chunk, [chunkname, [mode, [env]]])
loadfile([filename, [mode, [env]]])
next(table, [index])
pairs(t)
pcall(f, [arg1, ...])
rawequal(v1, v2)
rawget(table, index)
rawlen(v)
rawset(table, index, value)
select(index, ...)
setmetatable(table, metatable)
tonumber(e, [base])
tostring(v)
type(v)
xpcall(f, msgh, [arg1, ...])
coroutine.create(f)
coroutine.isyieldable()
coroutine.resume(co, [val1, ...])
coroutine.running()
coroutine.status(co)
coroutine.wrap(f)
coroutine.yield(...)
math.abs(x)
math.acos(x)
math.asin(x)
math.atan(y, [x])
math.ceil(x)
math.cos(x)
math.deg(x)
math.exp(x)
math.floor(x)
math.fmod(x)
math.huge
math.log(x, [base])
math.max(x, ...)
math.maxinteger
math.min(x, ...)
math.mininteger
math.modf(x)
math.pi
math.rad(x)
math.random([m, [n]])
math.randomseed(x)
math.sin(x)
math.sqrt(x)
math.tan(x)
math.tointeger(x)
math.type(x)
math.ult(m, n)
string.byte(s, [i, [j]])
string.char(...)
string.dump(function, [strip])
string.find(s, pattern, [init, [plain]])
string.format(formatstring, ...)
string.gmatch(s, pattern)
string.gsub(s, pattern, repl, [n])
string.len(s)
string.lower(s)
string.match(s, pattern, [init])
string.pack(fmt, v1, v2, ...)
string.packsize(fmt)
string.rep(s, n, [sep])
string.reverse(s)
string.sub(s, i, [j])
string.unpack(fmt, s, [pos])
string.upper(s)
table.concat(list, [sep, [i, [j]]])
table.insert(list, [pos], value)
table.move(a1, f, e, t, [a2])
table.pack(...)
table.remove(list, [pos])
table.sort(list, [comp])
table.unpack(list, [i, [j]])