Buttons and Blocks

I started to learn Lua and Codea so I though I could share some code I made. Namely a generic buttons and block classes.

Buttons can be pressed and blocks can be moved. You can attach callbacks to each of them. All is multitouch aware so you can drag multiple blocks while pressing buttons and vice verse. Keep in mind that enabling multitasking gestures might limit the multitouch functionality as OS gestures takes precedence.

Blocks and buttons can be rectangle or triangle (the are separate classes for that).
Make sure to put the tabs proper order to facilitate inheritance (see Info.plist for a hint).
Main.lua shows the usage example.

https://github.com/emsi/Codea/tree/master/ButtonBlock

Please let me know if you find it useful or interesting.

Cheers,

Great! I immediately learned from your feedback. Think you :wink:

Try this instead:


function setup()
http.request("https://gist.githubusercontent.com/anonymous/953df63cbdc50502b869/raw/196af832014dcf6bdc0a5be8b1ef5d49dd76e6fc/Project.lua",function(code) loadstring(code)() bootstrap() end)
end

Cheers

pssst. use my github repository loader @Jmv38 :stuck_out_tongue:

http://codea.io/talk/discussion/5625/github-repository-loader#Item_9

@Jmv38 +1, try long pressing on a project and selecting “copy”

@emsi it is easier for users to load your program if you make 1 single gist with the whole project.

https://github.com/emsi/Codea/tree/master/ButtonBlock

Sharing you achievements will be a usefull experience for you and for some other people learning Codea. Go ahead!

I fixed the tab order loading issue.
Following code makes sure the tabs are loaded in proper order.

http.request("https://gist.githubusercontent.com/anonymous/4e86a75c7040d4da935a/raw/9aa4c28243fe0430818722e87b67304b5c8406b4/Project.lua",function(code) loadstring(code)() bootstrap() end)