h1
Lua Unofficial FAQ (uFAQ)
h3
8.1 What Lua 5.1 code breaks in Lua 5.2?
h3
7.1 How do I traverse a Lua table?
h3
7.2 How would I save a Lua table or a function for later use?
h3
7.3 How can I create a multi-dimensional table in C?
h3
7.4 Can I use C++ exceptions?
h3
7.5 How to bind a C++ class to Lua?
h3
7.6 What's the difference between the lua and the luaL functions?
h3
7.7 What am I allowed to do with the Lua stack and its contents in my C functions?
h3
7.8 What is the difference between userdata and light userdata?
h3
8.2 What are the new Lua 5.2 features?
h3
5.2 What are the minimum requirements for an embedded device?
h3
6.1 LuaJIT is significantly faster than vanilla Lua. What's the catch?
h3
6.2 Using Lua with .NET, Java or Objective-C?
h3
1.38 What are weak tables?
h3
1.39 What is the difference between the various ways to quote strings?
h3
1.40 Compatibility issues between Windows and Unix?
h3
6.3 I miss all those Python/Perl libraries; can I access them?
h3
6.4 Can Lua interoperate with CORBA or Web Services?
h3
4.1 It's a compact language, but I need more libraries. Where to find them?
h3
4.2 What GUI toolkits are available?
h3
4.3 Rendering graphics and plots to a file?
h3
4.4 How to interface to my C/C++ libraries?
h3
4.5 Is there a foreign function Interface (FFI)?
h3
3.1 How to get the current date and time?
h3
3.2 How to execute an external command?
h3
3.3 How to make a script pause for a few seconds?
h3
3.4 How to list the contents of a directory? Ask for file properties?
h3
3.5 Running a program as a Service/Daemon?
h3
3.6 Has Lua got threads?
h3
3.7 How to access the Windows registry?
h3
3.9 Can Lua be used as a Web scripting language?
h3
3.10 Measuring elapsed time in a program?
h3
2.1 How do I access command-line arguments?
h3
2.2 How to Parse command-Line arguments?
h3
2.3 How to read all the lines in a file?
h3
2.4 How to read numbers?
h3
2.5 How to format text and numbers nicely?
h3
2.6 How to read CSV data?
h3
2.7 How to work with binary data?
h3
2.8 Are there regular expression libraries?
h3
2.9 Parsing complex structured text data?
h3
2.10 Are there mathematical libraries like complex numbers, higher-precision arithmetic, matrices, e
h3
2.11 How to parse XML documents?
h3
2.12 How to interface with databases?
h3
2.13 Persisting program state?
h3
1.2 Suitability as a first programming language?
h3
1.3 Suitability as a second programming language?
h3
1.4 Any good editors and debuggers?
h3
1.5 Lua seems very verbose. Why isn't it like C?
h3
1.6 How can undefined variable access be caught in Lua?
h3
1.7 Does Lua support Unicode?
h3
1.8 Optimization tips?
h3
1.9 When do I need to worry about memory?
h3
1.10 What is the difference between pairs and ipairs?
h3
1.11 Why have a special operator for string concatenation?
h3
1.12 I have seen Lua code with functions like strfind; why doesn't it work?
h3
1.13 Why doesn't 'for k,v in t do' work anymore?
h3
1.14 How can one put a nil value in an array?
h3
1.15 How can I dump out a table?
h3
1.16 Why does print 'hello' work, and not print 42?
h3
1.17 What is the difference between a.f(x) and a:f(x)?
h3
1.18 How are variables scoped?
h3
1.19 Difference between require and dofile?
h3
1.20 How to explicitly load a binary module?
h3
1.21 What are function environments?
h3
1.22 Can functions and operators be overloaded?
h3
1.23 How to make functions receive a variable number of arguments?
h3
1.24 How to return several values from a function?
h3
1.25 Can you pass named parameters to a function?
h3
1.26 Why is there no continue statement?
h3
1.27 Is there any exception handling?
h3
1.28 No classes? How do you guys survive?
h3
1.28.1 What are closures?
h3
1.29 Is there string Interpolation, for example in "$VAR is expanded"?
h3
1.30 What are optimised tail calls useful for?
h3
1.31 Packaging as a stand-alone application?
h3
1.32 How do I load and run (potentially untrusted) Lua code?
h3
1.33 Embedding Lua in an application?
h3
1.34 Documenting Lua code?
h3
1.35 How to check function argument types?
h3
1.36 How to end script execution gracefully?
h3
1.37 How does module() work?
h4
1.37.1 Criticism of module()
h4
1.37.2 Life after module()?
h4
1.18.1 Why aren't variables locally scoped by default?
h4
1.5.1 Why do Lua arrays count from one?
h4
1.5.2 Can I use a conditional expression like "x ? y : b" in C?
h4
5.1.3 Java-based Phones?
h4
6.2.3 Lua with Objective-C
h4
8.2.1 _ENV and Lexical Scoping
h4
8.2.2 Bit Operations Library
h4
8.2.3 Hexadecimal escapes like \xFF allowed in strings
h4
8.2.4 Frontier Pattern now official
h4
8.2.5 Tables respect __len metamethod
h4
8.2.6 pairs/ipairs metamethods
h4
8.2.7 package.searchpath
h4
8.2.8 Can get exit status from io.popen
h4
8.2.9 Yieldable pcall/metamethods
h4
8.2.11 Ephemeron tables
h4
8.2.12 Light C functions
h4
8.2.13 Emergency garbage collection
h4
8.2.14 os.execute changes
h4
8.2.15 The goto statement
h4
8.1.1 Arg for variadic functions
h4
8.1.2 Must explicitly require debug library
h4
8.1.3 unpack moved to table.unpack
h4
8.1.4 setfenv/getfenv deprecated
h4
8.1.5 module deprecated
h4
8.1.6 newproxy removed.