Lua Frequently Asked Questions (FAQ)
-
1.1 Where to start?
-
1.2 Suitability as a first programming language?
-
1.3 Suitability as a second programming language?
-
1.4 Any good editors and debuggers?
-
1.5 Lua seems very verbose. Why isn't it like C?
-
1.6 How can undefined variable access be caught in Lua?
-
1.7 Does Lua support Unicode?
-
1.8 Optimization tips?
-
1.9 When do I need to worry about memory?
-
1.10 What is the difference between pairs and ipairs?
-
1.11 Why have a special operator for string concatenation?
-
1.12 I have seen Lua code with functions like strfind; why doesn't it work?
-
1.13 Why doesn't 'for k,v in t do' work anymore?
-
1.14 How can one put a nil value in an array?
-
1.15 How can I dump out a table?
-
1.16 Why does print 'hello' work, and not print 42?
-
1.17 What is the difference between a.f(x) and a:f(x)?
-
1.18 How are variables scoped?
-
1.19 Difference between require and dofile?
-
1.20 How to explicitly load a binary module?
-
1.21 What are function environments?
-
1.22 Can functions and operators be overloaded?
-
1.23 How to make functions receive a variable number of arguments?
-
1.24 How to return several values from a function?
-
1.25 Can you pass named parameters to a function?
-
1.26 Why is there no continue statement?
-
1.27 Is there any exception handling?
-
1.28 No classes? How do you guys survive?
-
1.28.1 What are closures?
-
1.29 Is there string Interpolation, for example in "$VAR is expanded"?
-
1.30 What are optimised tail calls useful for?
-
1.31 Packaging as a stand-alone application?
-
1.32 How do I load and run (potentially untrusted) Lua code?
-
1.33 Embedding Lua in an application?
-
1.34 Documenting Lua code?
-
1.35 How to check function argument types?
-
1.36 How to end script execution gracefully?
-
1.37 How does module() work?
-
1.38 What are weak tables?
-
1.39 What is the difference between the various ways to quote strings?
-
1.40 Compatibility issues between Windows and Unix?
-
2.1 How do I access command-line arguments?
-
2.2 How to Parse command-Line arguments?
-
2.3 How to read all the lines in a file?
-
2.4 How to read numbers?
-
2.5 How to format text and numbers nicely?
-
2.6 How to read CSV data?
-
2.7 How to work with binary data?
-
2.8 Are there regular expression libraries?
-
2.9 Parsing complex structured text data?
-
2.10 Are there mathematical libraries like complex numbers, higher-precision arithmetic, matrices, etc?
-
2.11 How to parse XML documents?
-
2.12 How to interface with databases?
-
2.13 Persisting program state?
-
3.1 How to get the current date and time?
-
3.2 How to execute an external command?
-
3.3 How to make a script pause for a few seconds?
-
3.4 How to list the contents of a directory? Ask for file properties?
-
3.5 Running a program as a Service/Daemon?
-
3.6 Has Lua got threads?
-
3.7 How to access the Windows registry?
-
3.8 Sending an email?
-
3.9 Can Lua be used as a Web scripting language?
-
3.10 Measuring elapsed time in a program?
-
4.1 It's a compact language, but I need more libraries. Where to find them?
-
4.2 What GUI toolkits are available?
-
4.3 Rendering graphics and plots to a file?
-
4.4 How to interface to my C/C++ libraries?
-
4.5 Is there a foreign function Interface (FFI)?
-
5.1 Smart Phones
-
5.2 What are the minimum requirements for an embedded device?
-
6.1 LuaJIT is significantly faster than vanilla Lua. What's the catch?
-
6.2 Using Lua with .NET, Java or Objective-C?
-
6.3 I miss all those Python/Perl libraries; can I access them?
-
6.4 Can Lua interoperate with CORBA or Web Services?
-
7.1 How do I traverse a Lua table?
-
7.2 How would I save a Lua table or a function for later use?
-
7.3 How can I create a multi-dimensional table in C?
-
7.4 Can I use C++ exceptions?
-
7.5 How to bind a C++ class to Lua?
-
7.6 What's the difference between the lua and the luaL functions?
-
7.7 What am I allowed to do with the Lua stack and its contents in my C functions?
-
7.8 What is the difference between userdata and light userdata?
-
8.1 What Lua 5.1 code breaks in Lua 5.2?
-
More