TIC-80 API一覧
TIC-80のプログラムを作る際に、APIの書式を確認したくなることが多かったので、公式Wikiから抜き出して一覧化してみました。主に自分向けです。
コマンド
addcd <dir>clsconfig [save | default]del <file>demodireditexitexport [html | native | sprites | cover | map]folderget <file>helpimport [sprites | cover | map]keymapload <cart> [sprites | map | cover | code | sfx | music | palette]mkdirnew [lua | moon | js]ramresumerunsave <cart>surfversion
コールバック
TIC()scanline(line)
API
btn([id: 0..5 8..13]) -> pressedbtnp([id: 0..5 8..13, [hold period]]) -> pressed but wasn't pressed in previous frameclip([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) -> widthline(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) -> idmouse() -> x, y, pressedmset(x, y, id)music([track=-1], [frame=-1], [row=-1], [loop=true])peek(addr) -> valpeek4(addr4) -> val4pix(x, y, [color]) -> colorpmem(index:0..6, [val]) -> valpoke(addr, val)poke4(addr4, val)print(text, [x=0, y=0], [color=15], [fixed=false], [scale=1]) -> widthrect(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 starttrace(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_VERSIONassert(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.hugemath.log(x, [base])math.max(x, ...)math.maxintegermath.min(x, ...)math.minintegermath.modf(x)math.pimath.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]])