Upgrade to Pro — share decks privately, control downloads, hide ads and more …

You should check out Lua

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

You should check out Lua

Given twice in February 2013, at Human Talks Paris and the Paris Hackers Meetup. Web-based slides at http://files.catwell.info/presentations/2013-02-human-talks-lua/

Avatar for Pierre Chapuis

Pierre Chapuis

February 12, 2013
Tweet

More Decks by Pierre Chapuis

Other Decks in Programming

Transcript

  1. Lu- what? • multiparadigm dynamic language • "a better JavaScript"

    • lightweight ANSI C library • simple -> learn & understand 1 [1] You have been warned...
  2. Simple? Lua is much simpler than JS. This means you

    can make a simple interpreter that runs fast enough to be balanced with respect to the trace-JITted code. Brendan Eich “
  3. LuaJIT: FFI l o c a l f f i

    = r e q u i r e ( " f f i " ) f f i . c d e f [ [ u n s i g n e d l o n g c o m p r e s s B o u n d ( u n s i g n e d l o n g s o u r c e L e n ) ; i n t c o m p r e s s 2 ( u i n t 8 _ t * d e s t , u n s i g n e d l o n g * d e s t L e n , c o n s t u i n t 8 _ t * s o u r c e , u n s i g n e d l o n g s o u r c e L e n , i n t l e v e l ) ; ] ] l o c a l z l i b = f f i . l o a d ( " z " ) l o c a l c o m p r e s s = f u n c t i o n ( t x t ) l o c a l n = z l i b . c o m p r e s s B o u n d ( # t x t ) l o c a l b u f = f f i . n e w ( " u i n t 8 _ t [ ? ] " , n ) l o c a l b u f l e n = f f i . n e w ( " u n s i g n e d l o n g [ 1 ] " , n ) a s s e r t ( z l i b . c o m p r e s s 2 ( b u f , b u f l e n , t x t , # t x t , 9 ) = = 0 ) r e t u r n f f i . s t r i n g ( b u f , b u f l e n [ 0 ] ) e n d l o c a l t x t = s t r i n g . r e p ( " a b c d " , 1 0 0 0 ) l o c a l c = c o m p r e s s ( t x t )
  4. Used in games Angry Birds, Cry Engine 2 (Crysis), World

    of Warcraft, L.A. Noire, Baldur's Gate, Heroes of Might & Magic V...
  5. Other uses VLC, Adobe Lightroom, Awesome WM (Kindle Touch), Redis,

    Luvit / LUV, nginx, nmap, wireshark, SnabbSwitch, NetBSD, Codea, Roblox...
  6. Who was that, again? Pierre Chapuis, Moodstocks • http://catwell.info •

    @pchapuis Slides: http://is.gd/luaen (CC BY 3.0)