Skip to Content
Beginning Lua Programming
book

Beginning Lua Programming

by Kurt Jung, Aaron Brown
February 2007
Beginner
672 pages
15h 34m
English
Wrox
Content preview from Beginning Lua Programming

Chapter 11. Exploring Lua's Libraries

Up to this point in the book you've been learning about the fundamentals of Lua, occasionally using some of its library functions. In this chapter, all of Lua's standard library functions are briefly summarized to remind you of their basic usage. Practically every function has many more features than can be covered in detail within the scope of this book, and the examples that are included here are mostly contrived for brevity. (For the definitive documentation of these features, see the Lua Reference Manual.)

In this chapter, you'll find summaries of the following:

  • General-purpose functions in the core library

  • Functions that manage coroutines

  • Package functions that implement Lua's module system

  • String conversion and pattern matching functions

  • Functions that help with using tables as arrays

  • Bindings to the C runtime library's math functions

  • Functions for reading from and writing to files and streams

  • Operating system functions

  • Functions to help with debugging your Lua programs

An example is provided for each function or group of functions.

Core Library

The core library functions reside in the global environment. They have no containing namespace table.

Environment Functions

The following functions let you set and retrieve a function's environment—the table that Lua uses to resolve global references—and get or set the global environment of the running thread when given a stack level of 0:

  • getfenv(optional function or stack level): Returns the environment table ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Lua Quick Start Guide

Lua Quick Start Guide

Gabor Szauer
The Go Programming Language

The Go Programming Language

Alan A. A. Donovan, Brian W. Kernighan

Publisher Resources

ISBN: 9780470069172Purchase book