• Aucun résultat trouvé

Lua and Scripting – Cours et formation gratuit

N/A
N/A
Protected

Academic year: 2022

Partager "Lua and Scripting – Cours et formation gratuit"

Copied!
23
0
0

Texte intégral

(1)

Real Scripting with Lua

Roberto Ierusalimschy

(2)

Uses of Lua

Widely used in some niches

not a “web language”

Embedded systems

Scripting for applications

Games

(3)

3

Embedded systems

TVs (Samsung), routers (Cisco), keyboards

(Logitech), printers (Olivetti, Océ),set-top boxes (Ginga, Verizon), M2M devices (Sierra Wireless, Koneki), calculators (TI-Nspire), mobiles

(Huawei), …

Scripting for applications

Wireshark, Snort, Nmap, VLC Media Player, lighttpd, LuaTeX, Flame, …

(4)

Slashdot: News for nerds, Feb 1, 2012:

“Wikipedia Chooses Lua As Its New template

language”

(5)

5

Adobe Lightroom

more than one milion lines of Lua code

(6)
(7)

7

(8)

What About Lua?

Yet another scripting language

Goals

Emphasis on scripting

Portable

Small

Simple

Efficient

(9)

9

Scripting

Scripting language x dynamic language

scripting emphasizes inter-language communication

Program written in two languages

a scripting language and a system language

System language implements the hard parts of the application

algorithms, data structures

little change

Scripting glues together the hard parts

flexible, easy to change

(10)

Scripting in Grim Fandango

[The engine] doesn't know anything about adventure games, or talking, or puzzles, or anything else that makes Grim Fandango the game it is. It just knows how to render a set from data that it's loaded and draw characters in that set.

[…]

The real heroes in the development of Grim Fandango were the scripters. They wrote everything from how to

respond to the controls to dialogs to camera scripts to door scripts to the in-game menus and options screens. […]

A TREMENDOUS amount of this game is written in Lua.

(11)

11

Lua and Scripting

Lua is implemented as a library

Lua has been designed for scripting

Good for embedding and extending

Embedded in C/C++, Java, Fortan, C#, Perl,

Ruby, Python, etc.

(12)

Portablility

Runs virtually everywhere

Symbian, Nintendo DS, PSP, PS3, Android, iOS, IBM z/OS, etc.

Written in ANSI C

Kernel is a free-standing application

Can run inside the OS kernel

Can run over the “bare metal”

(13)

13

Size

(14)

Simplicity

Reference manual with 100 pages

(spine)

Documents the language, the C API, and the standard

libraries

(15)

15

Efficiency

Several benchmarks show Lua among the fastest languages in the realm of interpreted languages with dynamic typing

Mix of simplicity and some new techniques

LuaJIT

(16)

Aren't these goals about the implementation, not about

the language?

(17)

17

Aren't these goals about the implementation, not about

the language?

No

.

(18)

Aren't these goals about the implementation, not about

the language?

No

.

(Maybe, but big impact on language

(19)

19

Emphasis on scripting

few syntactical constructions

function-style

Portable

few standard libraries

even fewer primitive operations

Small, Simple

minimalistic design

Efficient

Impact on Design

(20)

Lectures

Introduction about Lua, scripting

Tables

Modules and Objects

Coroutines

API Lua-C

(21)

21

www.lua.org

(22)

Books

(23)

23

Lua: cute, efficient, and becoming very

trendy

If programming

languages were cars

http://machinegestalt.posterous.com/

if­programming­languages­were­cars

If programming

languages were religions

Lua would be Wicca - A

pantheistic language that can easily be adapted for

different cultures and

locations. Its code is very

liberal, and allows for the use of techniques that might be described as magical by

those used to more

traditional languages. It has a strong connection to the moon.

http://blog.aegisub.org/2008/12/

if­programming­languages­were­

religions.html

Références

Documents relatifs

It also seemed relevant to examine the value attributed to this belief in itself, therefore we asked: is having to work with a colleague who believes (vs. who does not believe) in

Nous consid´erons deux situations mod`eles dans lesquelles nous montrons que cette combinaison d’effets induit des ph´enom`enes de mouillage tout a` fait inhabituels : dans une

However in the present corpus it is shown that the word can also be the only term of the second alternative, leaving the addressee with just implicit

ʐ Let's just mud with nginx.conf, the Nginx

• Custom types defined in C “libraries” with library factory methods as well as instance methods. Saturday, December

io.output ([file]) sets file as default output file (the current output file is not closed); file can be either an open file object or a file name; in the latter case the file is

•  Scripts can be tagged as favorite and run from Utilities, Execute Script.. Script

“[The engine] doesn't know anything about adventure games, or talking, or puzzles, or anything else that makes Grim Fandango the game it is. It just knows how to render a set