Slide 1

Slide 1 text

You should check out Human Talks Paris, 2013-02-12

Slide 2

Slide 2 text

Who's that guy? Pierre Chapuis, Moodstocks • http://catwell.info • @pchapuis Slides: http://is.gd/luaen (CC BY 3.0)

Slide 3

Slide 3 text

Warning • not (too much) code • controversual ideas

Slide 4

Slide 4 text

Lu- what? • multiparadigm dynamic language • "a better JavaScript" • lightweight ANSI C library • simple -> learn & understand 1 [1] You have been warned...

Slide 5

Slide 5 text

Lightweight? ~ 100kB core + 100kB stdlib, 4kB RAM

Slide 6

Slide 6 text

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 “

Slide 7

Slide 7 text

LuaJIT: fast! 1 64 bits core, may 2010 :(

Slide 8

Slide 8 text

No libraries? :(

Slide 9

Slide 9 text

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 )

Slide 10

Slide 10 text

Used in games Angry Birds, Cry Engine 2 (Crysis), World of Warcraft, L.A. Noire, Baldur's Gate, Heroes of Might & Magic V...

Slide 11

Slide 11 text

Used in games

Slide 12

Slide 12 text

Used on mobile • Corona • Moai • Gideros Studio • Wax • Kobold2D

Slide 13

Slide 13 text

Other uses VLC, Adobe Lightroom, Awesome WM (Kindle Touch), Redis, Luvit / LUV, nginx, nmap, wireshark, SnabbSwitch, NetBSD, Codea, Roblox...

Slide 14

Slide 14 text

Other uses

Slide 15

Slide 15 text

Other uses

Slide 16

Slide 16 text

Going further • lua.org docs • PiL

Slide 17

Slide 17 text

Who was that, again? Pierre Chapuis, Moodstocks • http://catwell.info • @pchapuis Slides: http://is.gd/luaen (CC BY 3.0)