Avançar >


Programming in Lua Notes


Contents

Programming in Lua Notes 2

Getting Started 2

Types and Values 3

Expressions 4

Statements 4

Functions 5

More about Functions 6

Iterators and the Generic for 6

Compilation, Execution and Errors 7

Coroutines 8

Complete Examples 9

Data Structures 10

Data Files and Persistence 11

Metatables and Metamethods 11

The Environment 13

Modules and Packages 14

Object-Oriented Programming 14

Weak Tables and Finalizers 16

Weak Tables 16

Finalizers 16

The Mathematical Library 17

The Bitwise Library 17

The Table Library 18

The String Library 18

The I/O Library 19

The Simple I/O Model 20

The Complete I/O Model 20

The Operating System Library 21

The Debug Library 22

An Overview of the C API 23

About the C API 23

The Header Files 24

Extending Your Application 24

Calling a Lua function from C 24

Calling C from Lua 25

C Functions 25

Continuations 26

C Modules 26

Techniques for Writing C Functions 26

Array Manipulation 26

String Manipulation 27

Storing State in C Functions 28

User-Defined Types in C 30

Memory Management 30

Memory Allocation 31

The Garbage Collector 31


Programming in Lua NotesGetting StartedTypes and ValuesExpressionsStatementsFunctionsMore about FunctionsIterators and the Generic forCompilation, Execution and ErrorsCoroutinesComplete ExamplesData StructuresData Files and PersistenceMetatables and MetamethodsThe EnvironmentModules and PackagesObject-Oriented ProgrammingWeak Tables and FinalizersWeak TablesFinalizersThe Mathematical LibraryThe Bitwise LibraryThe Table LibraryThe String LibraryThe I/O LibraryThe Simple I/O ModelThe Complete I/O ModelThe Operating System LibraryThe Debug LibraryAn Overview of the C APIAbout the C APIThe Header FilesExtending Your ApplicationCalling a Lua function from CCalling C from LuaC FunctionsContinuationsC ModulesTechniques for Writing C FunctionsArray ManipulationString ManipulationStoring State in C FunctionsUser-Defined Types in CMemory ManagementMemory AllocationThe Garbage Collector