Abstract
Lua is a scripting language used in many industrial applications, with an emphasis on embedded systems and games. Two key points in the design of the language that led to its widely adoption are flexibility and small size. To achieve these two conflicting goals, the design emphasizes the use of few but powerful mechanisms, such as first-class functions, associative arrays, coroutines, and reflexive capabilities. As a consequence of this design, although Lua is primarily a procedural language, it is frequently used in several different programming paradigms, such as functional, object-oriented, goal-oriented, and concurrent programming, and also for data description.
In this paper we discuss what mechanisms Lua features to achieve its flexibility and how programmers use them for different paradigms.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Millington, I.: Artificial Intelligence for Games. Morgan Kaufmann, San Francisco (2006)
Associação Brasileira de Normas Técnicas: Televisão digital terrestre – Codificação de dados e especificações de transmissão para radiodifusão digital, ABNT NBR 15606-2 (2007)
Hempel, R.: Porting Lua to a microcontroller. In: de Figueiredo, L.H., Celes, W., Ierusalimschy, R. (eds.) Lua Programming Gems. Lua.org (2008)
Ierusalimschy, R.: Programming in Lua. second edn. Lua.org, Rio de Janeiro, Brazil (2006)
Ierusalimschy, R., de Figueiredo, L.H., Celes, W.: Lua 5.1 Reference Manual. Lua.org, Rio de Janeiro, Brazil (2006)
de Moura, A.L., Ierusalimschy, R.: Revisiting coroutines. ACM Transactions on Programming Languages and Systems 31(2), 6.1–6.31 (2009)
Ousterhout, J.K.: Scripting: Higher level programming for the 21st century. IEEE Computer 31(3) (March 1998)
Ierusalimschy, R., de Figueiredo, L.H., Celes, W.: The evolution of Lua. In: Third ACM SIGPLAN Conference on History of Programming Languages, San Diego, CA, June 2007, pp. 2.1–2.26 (2007)
Lamport, L.: LaTeX: A Document Preparation System. Addison-Wesley, Reading (1986)
Koyama, T., et al.: Simulation tools for damping in high frequency resonators. In: 4th IEEE Conference on Sensors, pp. 349–352. IEEE, Los Alamitos (2005)
Ueno, Y., Arita, M., Kumagai, T., Asai, K.: Processing sequence annotation data using the Lua programming language. Genome Informatics 14, 154–163 (2003)
Kelsey, R., Clinger, W., Rees, J.: Revised5 report on the algorithmic language Scheme. Higher-Order and Symbolic Computation 11(1), 7–105 (1998)
Nehab, D.: Filters, sources, sinks and pumps, or functional programming for the rest of us. In: de Figueiredo, L.H., Celes, W., Ierusalimschy, R. (eds.) Lua Programming Gems, pp. 97–107. Lua.org (2008)
Steele Jr., G.L.: Rabbit: A compiler for Scheme. Technical Report AITR-474, MIT, Cambridge, MA (1978)
Adams, N., Kranz, D., Kelsey, R., Rees, J., Hudak, P., Philbin, J.: ORBIT: an optimizing compiler for Scheme. SIGPLAN Notices 21(7) (July 1986); (SIGPLAN 1986)
Ierusalimschy, R., de Figueiredo, L.H., Celes, W.: The implementation of Lua 5.0. Journal of Universal Computer Science 11(7), 1159–1176 (2005); (SBLP 2005)
Ungar, D., Smith, R.B.: Self: The power of simplicity. SIGPLAN Notices 22(12), 227–242 (1987); (OOPLSA 1987)
Lieberman, H.: Using prototypical objects to implement shared behavior in object-oriented systems. SIGPLAN Notices 21(11), 214–223 (1986); (OOPLSA 1986)
Griswold, R., Griswold, M.: The Icon Programming Language. Prentice-Hall, New Jersey (1983)
Clocksin, W., Mellish, C.: Programming in Prolog. Springer, Heidelberg (1981)
Hutton, G.: Higher-order functions for parsing. Journal of Functional Programming 2(3), 323–343 (1992)
de Moura, A.L., Rodriguez, N., Ierusalimschy, R.: Coroutines in Lua. Journal of Universal Computer Science 10(7), 910–925 (2004); (SBLP 2004)
Haynes, C.T.: Logic continuations. J. Logic Programming 4, 157–176 (1987)
Wand, M., Vaillancourt, D.: Relating models of backtracking. In: Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming, Snowbird, UT, pp. 54–65. ACM, New York (2004)
Ierusalimschy, R., de Moura, A.L.: Some proofs about coroutines. Monografias em Ciência da Computação 04/08, PUC-Rio, Rio de Janeiro, Brazil (2008)
Ousterhout, J.K.: Why threads are a bad idea (for most purposes). In: USENIX Technical Conference (January 1996)
Birtwistle, G., Dahl, O., Myhrhaug, B., Nygaard, K.: Simula Begin. Petrocelli Charter (1975)
Kauppi, A.: Lua Lanes — multithreading in Lua (2009), http://kotisivu.dnainternet.net/askok/bin/lanes/
Skyrme, A., Rodriguez, N., Ierusalimschy, R.: Exploring Lua for concurrent programming. In: XII Brazilian Symposium on Programming Languages, Fortaleza, CE, August 2008, pp. 117–128 (2008)
Fernandes, F., Batista, T.: Dynamic aspect-oriented programming: An interpreted approach. In: Proceedings of the 2004 Dynamic Aspects Workshop (DAW 2004), March 2004, pp. 44–50 (2004)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Ierusalimschy, R. (2010). Programming with Multiple Paradigms in Lua. In: Escobar, S. (eds) Functional and Constraint Logic Programming. WFLP 2009. Lecture Notes in Computer Science, vol 5979. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-11999-6_1
Download citation
DOI: https://doi.org/10.1007/978-3-642-11999-6_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-11998-9
Online ISBN: 978-3-642-11999-6
eBook Packages: Computer ScienceComputer Science (R0)