Difference between revisions of "Lua for TIC80"

From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search
Line 2: Line 2:
  
 
== if ==
 
== if ==
 +
 +
<source lang="lua">
 +
if btn(0) then
 +
t=t+1
 +
elseif btn(1) then
 +
t=t-1
 +
end
 +
</source>
  
 
== for ==
 
== for ==

Revision as of 21:15, 31 January 2021

tables

if

if btn(0) then
 t=t+1
elseif btn(1) then
 t=t-1
end

for

See: https://www.lua.org/pil/4.3.4.html

function TIC()
 cls(0)
 
 for i=1,100,2 do
  rect(0,0,i,i,i%16)
 end

end

function

break, return

https://www.lua.org/pil/4.4.html