Full Code of Neopallium/llvm-lua for AI

master 65123d239629 cached
180 files
1.1 MB
456.5k tokens
990 symbols
1 requests
Download .txt
Showing preview only (1,219K chars total). Download the full file or copy to clipboard to get everything.
Repository: Neopallium/llvm-lua
Branch: master
Commit: 65123d239629
Files: 180
Total size: 1.1 MB

Directory structure:
gitextract_gz0j2dmj/

├── .gitignore
├── .hgignore
├── AUTHORS
├── CMakeLists.txt
├── COPYRIGHT
├── ChangeLog
├── HISTORY
├── INSTALL
├── README
├── README.llvm-lua
├── TODO
├── cmake/
│   ├── CustomMacros.cmake
│   └── FindLLVM.cmake
├── cmake_uninstall.cmake.in
├── doc/
│   ├── contents.html
│   ├── lua.1
│   ├── lua.css
│   ├── lua.html
│   ├── luac.1
│   ├── luac.html
│   ├── manual.css
│   ├── manual.html
│   └── readme.html
├── etc/
│   ├── README
│   ├── all.c
│   ├── embed_jit.c
│   ├── embed_jit.cpp
│   ├── lua.hpp
│   ├── lua.pc
│   ├── luavs.bat
│   ├── min.c
│   ├── noparser.c
│   └── strict.lua
├── gen_changelog.sh
├── llvm-lua/
│   ├── CMakeLists.txt
│   ├── COPYRIGHT.llvm-lua
│   ├── LLVMCompiler.cpp
│   ├── LLVMCompiler.h
│   ├── LLVMDumper.cpp
│   ├── LLVMDumper.h
│   ├── TODO
│   ├── bin2c.c
│   ├── compile_all.sh
│   ├── hook_parser.c
│   ├── llvm-lua.cpp
│   ├── llvm-luac.cpp
│   ├── llvm_compiler.cpp
│   ├── llvm_compiler.h
│   ├── llvm_compiler_private.h
│   ├── llvm_dumper.cpp
│   ├── llvm_dumper.h
│   ├── llvm_lmathlib.c
│   ├── llvm_lua_config.h.in
│   ├── load_embedded_bc.cpp
│   ├── load_jit_proto.c
│   ├── load_jit_proto.h
│   ├── load_liblua_main.cpp
│   ├── load_liblua_main.h
│   ├── load_vm_ops.cpp
│   ├── load_vm_ops.h
│   ├── lua-compiler.in
│   ├── lua-cross-compiler.in
│   ├── lua_compiler.c
│   ├── lua_compiler.h
│   ├── lua_core.c
│   ├── lua_core.h
│   ├── lua_interpreter.c
│   ├── lua_interpreter.h
│   ├── lua_main.c
│   ├── lua_normal.c
│   ├── lua_vm_ops.c
│   ├── lua_vm_ops.h
│   ├── lua_vm_ops_static.c
│   ├── no_jit.c
│   ├── run_tests.sh
│   └── tests/
│       ├── NOTES
│       ├── add.lua
│       ├── arg_test.lua
│       ├── big_table.lua
│       ├── coroutine.lua
│       ├── dump.lua
│       ├── for.lua
│       ├── hash2.lua
│       ├── loadk.lua
│       ├── local_nil.lua
│       ├── loops.lua
│       ├── lua_tail.lua
│       ├── nestedloop.lua
│       ├── nestedloop2.lua
│       ├── nums.lua
│       ├── scimark_loop.lua
│       ├── scimark_rand.lua
│       ├── stress_for.lua
│       ├── test.lua
│       ├── test2.lua
│       ├── test3.lua
│       ├── test4.lua
│       ├── test_lineerror.lua
│       ├── test_math.lua
│       ├── test_tail.lua
│       ├── test_tail_nil_multret.lua
│       └── test_varg_tail2.lua
├── src/
│   ├── lapi.c
│   ├── lapi.h
│   ├── lauxlib.c
│   ├── lauxlib.h
│   ├── lbaselib.c
│   ├── lcoco.c
│   ├── lcoco.h
│   ├── lcode.c
│   ├── lcode.h
│   ├── ldblib.c
│   ├── ldebug.c
│   ├── ldebug.h
│   ├── ldo.c
│   ├── ldo.h
│   ├── ldump.c
│   ├── lfunc.c
│   ├── lfunc.h
│   ├── lgc.c
│   ├── lgc.h
│   ├── linit.c
│   ├── liolib.c
│   ├── llex.c
│   ├── llex.h
│   ├── llimits.h
│   ├── lmathlib.c
│   ├── lmem.c
│   ├── lmem.h
│   ├── loadlib.c
│   ├── lobject.c
│   ├── lobject.h
│   ├── lopcodes.c
│   ├── lopcodes.h
│   ├── loslib.c
│   ├── lparser.c
│   ├── lparser.h
│   ├── lstate.c
│   ├── lstate.h
│   ├── lstring.c
│   ├── lstring.h
│   ├── lstrlib.c
│   ├── ltable.c
│   ├── ltable.h
│   ├── ltablib.c
│   ├── ltm.c
│   ├── ltm.h
│   ├── lua.c
│   ├── lua.h
│   ├── luac.c
│   ├── luaconf.h
│   ├── lualib.h
│   ├── lundump.c
│   ├── lundump.h
│   ├── lvm.c
│   ├── lvm.h
│   ├── lzio.c
│   ├── lzio.h
│   └── print.c
├── test/
│   ├── README
│   ├── bisect.lua
│   ├── cf.lua
│   ├── echo.lua
│   ├── env.lua
│   ├── factorial.lua
│   ├── fib.lua
│   ├── fibfor.lua
│   ├── globals.lua
│   ├── hello.lua
│   ├── life.lua
│   ├── luac.lua
│   ├── printf.lua
│   ├── readonly.lua
│   ├── sieve.lua
│   ├── sort.lua
│   ├── table.lua
│   ├── trace-calls.lua
│   ├── trace-globals.lua
│   └── xd.lua
└── tools/
    └── hg_import_split.lua

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
build
llvm-lua/*.bc
llvm-lua/*_bc.h
src/.libs
src/*.o
src/*.lo
src/*.la
src/*.a
src/lua
src/luac
src/lua_test
.*.swp


================================================
FILE: .hgignore
================================================
# Backup files
.*~$
# Rejected patches
.*\.orig$
.*\.rej$
# Build directory
^build$


================================================
FILE: AUTHORS
================================================
bobby@neoawareness.com:Robert G. Jakabosky <bobby@neoawareness.com>


================================================
FILE: CMakeLists.txt
================================================
#
# llvm-lua
#
cmake_minimum_required(VERSION 2.4 FATAL_ERROR)

if(COMMAND cmake_policy)
  cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

project(llvm_lua C CXX)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

include(CustomMacros)
include(CMakeDependentOption)
include(FindLLVM)

enable_testing()

set(LLVM_LUA_NAME "llvm-lua")
set(LLVM_LUA_COPYRIGHT "Copyright (C) 2008-2009 Robert G. Jakabosky, http://code.google.com/p/llvm-lua/")

#
# Lua version
#
set(LUA_VERSION_MAJOR 5)
set(LUA_VERSION_MINOR 1)
set(LUA_VERSION_PATCH 4)
set(LUA_VERSION
				"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
set(LUA_SOVERSION
				"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}")

#
# llvm-lua version
#
set(LLVM_LUA_VERSION_MAJOR 1)
set(LLVM_LUA_VERSION_MINOR 3)
set(LLVM_LUA_VERSION_PATCH 1)
set(LLVM_LUA_VERSION
	"${LLVM_LUA_VERSION_MAJOR}.${LLVM_LUA_VERSION_MINOR}.${LLVM_LUA_VERSION_PATCH}")
set(LLVM_LUA_SOVERSION
	"${LLVM_LUA_VERSION_MAJOR}.${LLVM_LUA_VERSION_MINOR}")

#
# Lua package info.
#
set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_LUA_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_LUA_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${LLVM_LUA_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYRIGHT")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
set(CPACK_PACKAGE_VENDOR "")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES
"/\\\\.;/\\\\.git.*/;~$;build/;CMakeFiles/;CMakeCache;Testing/;cmake_install;CPack;Dart;Makefile$")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
	"${LLVM_LUA_NAME}-${LLVM_LUA_VERSION_MAJOR}.${LLVM_LUA_VERSION_MINOR}.${LLVM_LUA_VERSION_PATCH}")
# MUST be after CPACK_* variables.
include(CPack)

set(COMMON_CFLAGS)
set(COMMON_LDFLAGS)
set(LIBS)
#
# Detect system type
#
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	set(DEFAULT_POSIX TRUE)
	set(DEFAULT_DLOPEN ON)
	set(DEFAULT_READLINE ON)
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -Wl,-E")
	set(USE_RPATH TRUE)
	# This is a HACK.  We need to put the flags from `llvm-config --lflags` at
	# the end of the linker command.  If you know a better way to fix this let
	# me know.
	set(CMAKE_CXX_LINK_EXECUTABLE
		"<CMAKE_CXX_COMPILER>  <FLAGS> <CMAKE_CXX_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> <LINK_FLAGS>")
	SET(CMAKE_C_LINK_EXECUTABLE
		"<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> <LINK_FLAGS>")
elseif(APPLE)
	set(DEFAULT_POSIX TRUE)
	set(DEFAULT_DLOPEN ON)
	# use this on Mac OS X 10.3-
	option(LUA_USE_MACOSX "Mac OS X 10.3-" OFF)
	set(OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX")
	CMAKE_DEPENDENT_OPTION(WANT_FRAMEWORK
		"Set to ON to build framework instead of dylib." ON
		"WANT_SHARED_LIBRARY" ON
	)
	CMAKE_DEPENDENT_OPTION(LUA_FRAMEWORK_SYMLINKS
		"Set to ON to create symlinks to llvm-lua & llvm-luac to CMAKE_PREFIX_PATH/bin." ON
		"WANT_FRAMEWORK;WANT_SHARED_LIBRARY" ON
	)
	set(CMAKE_FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
	set(CMAKE_FRAMEWORK_INSTALL_NAME_DIR "@executable_path/../Frameworks" CACHE STRING "install_name path for framework.")
	set(CMAKE_DYLIB_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "install_name path for dylib.")
	set(LUA_FRAMEWORK_NAME "llvm-lua.framework")
	set(LUA_FRAMEWORK_VERSION_NUMBER "${LLVM_LUA_VERSION_MAJOR}.${LLVM_LUA_VERSION_MINOR}")
	set(LUA_FRAMEWORK_VERSIONED_EXECUTABLE_DIR "Versions/${LUA_FRAMEWORK_VERSION_NUMBER}/MacOS")
	set(LUA_FRAMEWORK_VERSIONED_LIB_DIR "Versions/${LUA_FRAMEWORK_VERSION_NUMBER}/lib")
	set(LUA_FRAMEWORK_CURRENT_EXECUTABLE_DIR "Versions/Current/MacOS")

	# For Apple install_name, is it better to detect if Xcode vs Makefile?
	# Xcode default=1, Makefile=0? Or detect if Framework vs. dylib,
	# Framework=1, dylib=0?
	option(CMAKE_BUILD_WITH_INSTALL_RPATH "Set to YES to set the rpath or install_name on build instead of install." ON)

	set(LUA_SOVERSION
				"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.0")
elseif(CYGWIN)
	set(DEFAULT_POSIX TRUE)
	set(USE_RPATH TRUE)
elseif(UNIX)
	set(DEFAULT_POSIX TRUE)
	set(USE_RPATH TRUE)
elseif(WIN32)
	set(LUA_WIN TRUE)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_BUILD_AS_DLL")
else(APPLE)
	set(DEFAULT_ANSI TRUE)
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")

#
# setup config options with default values.
#
option(WANT_SHARED_LIBRARY "Set to ON to build dynamic library." ON)
if(WIN32)
	set(WANT_STATIC_LIBRARY OFF)
else(WIN32)
	option(WANT_STATIC_LIBRARY "Set to ON to build static library." ON)
endif(WIN32)

option(WANT_NOJIT_LIBRARIES "Set to ON to build nojit libraries." ON)

if(USE_RPATH)
	set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "rpaths separated by semicolons.")
	option(CMAKE_BUILD_WITH_INSTALL_RPATH "Set to YES to set the rpath or install_name on build instead of install." OFF)
endif(USE_RPATH)

if(DEFAULT_DLOPEN)
	option(LUA_USE_DLOPEN "Enable dlopen support." ON)
else(DEFAULT_DLOPEN)
	option(LUA_USE_DLOPEN "Enable dlopen support." OFF)
endif(DEFAULT_DLOPEN)

if(DEFAULT_POSIX)
	option(LUA_USE_CURSES "Enable Curses support." ON)
	option(LUA_USE_MKSTEMP "Use mkstemp." ON)
	option(LUA_USE_ISATTY "Enable isatty support." ON)
	option(LUA_USE_POPEN "Enable lua_popen support." ON)
	option(LUA_USE_ULONGJMP "Try using _longjmp/_setjmp (more efficient)" ON)
else(DEFAULT_POSIX)
	option(LUA_USE_CURSES "Enable Curses support." OFF)
	option(LUA_USE_MKSTEMP "Use mkstemp." OFF)
	option(LUA_USE_ISATTY "Enable isatty support." OFF)
	option(LUA_USE_POPEN "Enable lua_popen support." OFF)
	option(LUA_USE_ULONGJMP "Try using _longjmp/_setjmp (more efficient)" OFF)
endif(DEFAULT_POSIX)

if(DEFAULT_READLINE)
	option(LUA_USE_READLINE "Enable readline support." ON)
else(DEFAULT_READLINE)
	option(LUA_USE_READLINE "Enable readline support." OFF)
endif(DEFAULT_READLINE)

if(DEFAULT_ANSI)
	option(LUA_ANSI "Disable non-ansi features." ON)
else(DEFAULT_ANSI)
	option(LUA_ANSI "Disable non-ansi features." OFF)
endif(DEFAULT_ANSI)

option(LUA_USE_APICHECK "Enable API checks." OFF)

#
# llvm-lua options.
#
option(LUA_CPP_SUPPORT "Enable c++ support" OFF)
set(LLVM_PATH "/usr" CACHE STRING "Path to LLVM/Clang.")
set(LLVM_CC "${LLVM_PATH}/bin/clang" CACHE STRING "Command to compile C-code to LLVM bitcode (clang or llvm-gcc)")
set(LLVM_LD "${LLVM_PATH}/bin/llvm-link" CACHE STRING "Command to link LLVM bitcode files into one bitcode file.")

#
# Cross-compile options.
#
option(CROSS_COMPILE "Build llvm-luac as a cross-compiler" OFF)
set(CROSS_ARCH "arm" CACHE STRING "Cross-compiler target.")
set(CROSS_TRIPLE "arm-linux-gnueabi" CACHE STRING "Cross-compiler target triple.")
set(CROSS_CPU "arm926ej-s" CACHE STRING "Cross-compiler target cpu name.")
set(CROSS_ISYSTEM
	"/usr/lib/gcc/arm-linux-gnueabi/4.6.3/include:/usr/lib/gcc/arm-linux-gnueabi/4.6.3/include-fixed:/usr/arm-linux-gnueabi/usr/include/"
	CACHE STRING "Path to target system includes.")

#
# LuaCoco options
#
option(COCO_USE_SETJMP "Coco: Force use of setjmp (instead of gccasm)" OFF)
option(COCO_USE_UCONTEXT "Coco: Force use of ucontext (instead of gccasm or setjmp)" OFF)
option(COCO_USE_VALGRIND "Enable valgrind debugging support" OFF)
option(COCO_DISABLE "Disable coco" OFF)
set(COCO_DEFAULT_CSTACKSIZE "" CACHE STRING "Coco default cstacksize")

#
# libs & cflags
#
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -lm ")

# For "Mac OS X 10.3-"
if(LUA_USE_MACOSX)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_MACOSX")
	set(LUA_USE_DLOPEN FALSE)
endif(LUA_USE_MACOSX)

# enable options
if(LUA_USE_DLOPEN)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_DLOPEN")
	if(NOT APPLE)
		set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -ldl ")
	endif(NOT APPLE)
endif(LUA_USE_DLOPEN)
if(LUA_USE_MKSTEMP)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_MKSTEMP")
endif(LUA_USE_MKSTEMP)
if(LUA_USE_ISATTY)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_ISATTY")
endif(LUA_USE_ISATTY)
if(LUA_USE_POPEN)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_POPEN")
endif(LUA_USE_POPEN)
if(LUA_USE_ULONGJMP)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_ULONGJMP")
endif(LUA_USE_ULONGJMP)
if(LUA_USE_APICHECK)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_APICHECK")
endif(LUA_USE_APICHECK)
if(LUA_ANSI)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_ANSI")
endif(LUA_ANSI)

# readline support
if(LUA_USE_READLINE AND NOT CROSS_COMPILE)
	FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h)
	FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
	if(READLINE_LIBRARY)
		set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_READLINE")
		set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -lreadline -lhistory")
		include_directories(${READLINE_INCLUDE_DIR})
	endif(READLINE_LIBRARY)
endif()

# curses
if(LUA_USE_CURSES AND NOT CROSS_COMPILE)
	include(FindCurses)
	if(CURSES_LIBRARY)
		include_directories(${CURSES_INCLUDE_DIR})
		set(LIBS ${LIBS} ${CURSES_LIBRARY})
	endif(CURSES_LIBRARY)
endif()

# LuaCoco flags
if(COCO_DISABLE)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DCOCO_DISABLE")
else(COCO_DISABLE)
	if(COCO_USE_SETJMP)
		set(COMMON_CFLAGS "${COMMON_CFLAGS} -DCOCO_USE_SETJMP")
	elseif(COCO_USE_UCONTEXT)
		set(COMMON_CFLAGS "${COMMON_CFLAGS} -DCOCO_USE_UCONTEXT")
	endif(COCO_USE_SETJMP)

	# check cstacksize variable.
	if(COCO_DEFAULT_CSTACKSIZE)
		set(COMMON_CFLAGS "${COMMON_CFLAGS} -DCOCO_DEFAULT_CSTACKSIZE=${COCO_DEFAULT_CSTACKSIZE}")
	endif(COCO_DEFAULT_CSTACKSIZE)
endif(COCO_DISABLE)

#
# Support for embedding llvm-lua into c++ programs with exception support.
#
if(LUA_CPP_SUPPORT)
	message(STATUS "Lua C++ support enabled, forcing usage of g++ & llvm-g++")
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_CPP_SUPPORT")
	include(CMakeForceCompiler)
	CMAKE_FORCE_C_COMPILER(${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ID})
	set(LLVM_CC "llvm-g++")
endif(LUA_CPP_SUPPORT)

#
# standard flags to use for each build type.
#
if(CMAKE_COMPILER_IS_GNUCC)
	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wshadow -W -std=gnu89 ")
	set(CMAKE_C_FLAGS_RELEASE        "${CMAKE_C_FLAGS_RELEASE}     -O2")
	set(CMAKE_C_FLAGS_DEBUG          "${CMAKE_C_FLAGS_DEBUG}       -O0 -g")
	set(CMAKE_C_FLAGS_PROFILE        "${CMAKE_C_FLAGS_PROFILE}     -O1 -g")
	set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
endif(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_COMPILER_IS_GNUCXX)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -Wall -Wshadow -W -pedantic")
	set(CMAKE_CXX_FLAGS_RELEASE        "${CMAKE_CXX_FLAGS_RELEASE}     -O2")
	set(CMAKE_CXX_FLAGS_DEBUG          "${CMAKE_CXX_FLAGS_DEBUG}       -O0 -g")
	set(CMAKE_CXX_FLAGS_PROFILE        "${CMAKE_CXX_FLAGS_PROFILE}     -O2 -g")
	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_WITHDEBINFO} -O2 -g")
endif(CMAKE_COMPILER_IS_GNUCXX)

#
# For uninstall (needs cmake_uninstall.cmake.in in the top-level directory)
#
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE @ONLY)
add_custom_target(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

#
# sub-folders
#
add_subdirectory(llvm-lua build)



================================================
FILE: COPYRIGHT
================================================
Lua License
-----------

Lua is licensed under the terms of the MIT license reproduced below.
This means that Lua is free software and can be used for both academic
and commercial purposes at absolutely no cost.

For details and rationale, see http://www.lua.org/license.html .

===============================================================================

Copyright (C) 1994-2008 Lua.org, PUC-Rio.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

===============================================================================

(end of COPYRIGHT)


================================================
FILE: ChangeLog
================================================
2009-11-05  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/CMakeLists.txt, llvm-lua/run_tests.sh, src/ldo.c,
	  src/lgc.c, src/lgc.h, src/lobject.h, src/lvm.c, src/lzio.h:
	  Emergency GC fixes.

2009-10-18  Robert G. Jakabosky <bobby@neoawareness.com>

	* CMakeLists.txt:
	  Fixed bug
	* AUTHORS, ChangeLog, gen_changelog.sh, llvm-lua/CMakeLists.txt,
	  llvm-lua/lua-compiler, llvm-lua/lua-compiler.in,
	  llvm-lua/lua-cross-compiler.in, llvm-lua/lua_compiler.c,
	  llvm-lua/run_tests.sh:
	  Added ChangeLog, Improved lua-compiler & lua-cross-compiler.
	  
	  Added -mcpu option to *-compiler scripts.
	  Changed -arch to -target option.
	  Embed the install prefix into lua-compiler so it can find
	  liblua_main.a
	  Added gen_changelog.sh script to generate ChangeLog from svn
	  history.

2009-10-17  Robert G. Jakabosky <bobby@neoawareness.com>

	* CMakeLists.txt, README.llvm-lua, src/loadlib.c:
	  Last commit missed these files.
	* llvm-lua/CMakeLists.txt, llvm-lua/Makefile,
	  llvm-lua/llvm-lua.cpp, llvm-lua/llvm-luac.cpp,
	  llvm-lua/lua-compiler, llvm-lua/lua_compiler.c:
	  Added support for preloading libraries during static compilling.
	  
	  Updated README.llvm-lua file.
	  Improved lua-compilers argument parsing.
	  
	  Now it is possible to static compile multiple Lua scripts and
	  there required sub-scripts into one standalone executable.

2009-10-15  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/compile_all.sh:
	  Wrong compiler in compile_all.sh.
	* cmake/CustomMacros.cmake, llvm-lua/CMakeLists.txt,
	  llvm-lua/compile_all.sh, llvm-lua/lua-compiler,
	  llvm-lua/lua-cross-compiler.in, llvm-lua/lua_core.h,
	  llvm-lua/lua_vm_ops.c, src/ldo.c:
	  Fixed bugs. Improved cross-compiler support.
	* src/lcoco.c, src/lcoco.h:
	  Update LuaCoco patch to 1.1.6

2009-10-14  Robert G. Jakabosky <bobby@neoawareness.com>

	* CMakeLists.txt, llvm-lua/CMakeLists.txt,
	  llvm-lua/lua-cross-compiler.in:
	  Adding cross-compiler support to CMake build scripts.

2009-10-07  Robert G. Jakabosky <bobby@neoawareness.com>

	* .svnignore, CMakeLists.txt, cmake_uninstall.cmake.in,
	  llvm-lua/CMakeLists.txt, llvm-lua/load_jit_proto.c,
	  llvm-lua/lua_core.c, llvm-lua/lua_vm_ops_static.c, src/loadlib.c,
	  src/lobject.h, src/lstate.h, src/ltable.c, src/luaconf.h:
	  Added MacOSX framework support.

2009-09-27  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/CMakeLists.txt:
	  Remove duplicate source files
	* CMakeLists.txt, llvm-lua/CMakeLists.txt:
	  Added lua-compiler to CMake build.
	* CMakeLists.txt, cmake, cmake/CustomMacros.cmake,
	  cmake/FindLLVM.cmake, llvm-lua/CMakeLists.txt, llvm-lua/Makefile:
	  Add CMake build scripts.

2009-09-23  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/Makefile,
	  llvm-lua/hook_parser.c, llvm-lua/llvm-lua.cpp,
	  llvm-lua/llvm_lmathlib.c, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops_static.c, llvm-lua/tests/coroutine.lua,
	  llvm-lua/tests/test_lineerror.lua, llvm-lua/tests/test_tail.lua,
	  llvm-lua/tests/test_tail_nil_multret.lua, src/lauxlib.c,
	  src/ldo.c, src/lvm.c:
	  Fixed memory leak, tailcalls, memlimit.
	  Release LLVM Function objects when Lua Proto's are garbage
	  collected.
	  Fixed a few of tailcall bugs.
	  Fixed a bug with the memlimit code.
	  Improved command line option parsing.
	  Added hack for iPhone support.

2009-09-22  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/tests/test_varg_tail2.lua:
	  Add testcase: tailcall from varg function.
	* llvm-lua/lua_vm_ops_static.c, src/ldo.c:
	  Fixed tailcall inside varg function bug.

2009-09-18  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/Makefile, llvm-lua/llvm-lua.cpp, llvm-lua/llvm-luac.cpp,
	  llvm-lua/llvm_compiler.cpp:
	  Fixed memory leaks and a memory access error.

2009-09-17  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/compile_all.sh,
	  llvm-lua/load_jit_proto.c, llvm-lua/lua-compiler:
	  Improved cross-compiling support.
	* llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/load_jit_proto.c, llvm-lua/load_jit_proto.h:
	  Made jit_proto & constant_type structures more portable.
	  Added correct amount of padding for target architecture.

2009-09-16  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/llvm-luac.cpp:
	  Adding support for all native backends to llvm-luac.
	* README.llvm-lua, etc/embed_jit.c, etc/embed_jit.cpp:
	  Added example 'embed_jit.c' & 'embed_jit.cpp' files.
	* llvm-lua/llvm_compiler.cpp:
	  Fixed bug with native target initialization.
	* llvm-lua/lua-compiler:
	  Add better support for -arch flag
	* llvm-lua/lua-compiler:
	  Removed debug messages.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/lua-compiler:
	  Added support for compiling static lua-modules.
	* llvm-lua/lua-compiler:
	  Removed unneeded "-rdynamic -Wl,-E" from 'lua-compiler' script.

2009-09-15  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/Makefile, llvm-lua/llvm_compiler.cpp,
	  llvm-lua/load_embedded_bc.cpp, llvm-lua/load_embedded_bc.h,
	  llvm-lua/load_liblua_main.cpp, llvm-lua/load_liblua_main.h,
	  llvm-lua/load_vm_ops.cpp, llvm-lua/load_vm_ops.h, src/lcode.c,
	  src/ldblib.c, src/lvm.c:
	  Ported code to LLVM 2.6 API.
	  Applied patches for Lua 5.1.4:
	  3. Wrong code generation for some particular boolean expressions
	  4. luaV_settable may invalidate a reference to a table and try to
	  reuse it.
	  5. debug.getfenv does not check whether it has an argument.

2009-06-16  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile:
	  Fixing MinGW support.

2009-06-07  Robert G. Jakabosky <bobby@neoawareness.com>

	* Makefile, llvm-lua/Makefile:
	  Add support for compiling shared library liblua-llvm.so

2009-06-04  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/lua-compiler:
	  Fixed bug with lua-compiler.
	  Added '-c++' option for static compiling Lua code with C++
	  exception support.
	* README.llvm-lua, llvm-lua/LLVMCompiler.cpp,
	  llvm-lua/LLVMCompiler.h, llvm-lua/LLVMDumper.cpp,
	  llvm-lua/LLVMDumper.h, llvm-lua/Makefile, llvm-lua/TODO,
	  llvm-lua/hook_parser.c, llvm-lua/llvm-lua.cpp,
	  llvm-lua/llvm-lua.h, llvm-lua/llvm-luac.cpp,
	  llvm-lua/llvm-luac.h, llvm-lua/llvm_compiler.cpp,
	  llvm-lua/llvm_compiler.h, llvm-lua/llvm_compiler_private.h,
	  llvm-lua/llvm_dumper.cpp, llvm-lua/llvm_dumper.h,
	  llvm-lua/llvm_lmathlib.c, llvm-lua/load_embedded_bc.cpp,
	  llvm-lua/load_embedded_bc.h, llvm-lua/load_jit_proto.c,
	  llvm-lua/load_jit_proto.h, llvm-lua/load_liblua_main.cpp,
	  llvm-lua/load_liblua_main.h, llvm-lua/load_vm_ops.cpp,
	  llvm-lua/load_vm_ops.h, llvm-lua/lua-compiler,
	  llvm-lua/lua_compiler.c, llvm-lua/lua_core.c,
	  llvm-lua/lua_core.h, llvm-lua/lua_interpreter.c,
	  llvm-lua/lua_main.c, llvm-lua/lua_normal.c,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops.h,
	  llvm-lua/lua_vm_ops_static.c, llvm-lua/no_jit.c, src/lcoco.h,
	  src/ldebug.c, src/ldebug.h, src/lstate.c, src/lstate.h,
	  src/luaconf.h, src/lvm.c, src/print.c:
	  Add C++ exception support. llvm-lua is now thread-safe.
	  
	  Moved LLVMCompiler instance from global variable to
	  'global_State'
	  to help make llvm-lua thread-safe.

2009-05-31  Robert G. Jakabosky <bobby@neoawareness.com>

	* README.llvm-lua, llvm-lua/lua-compiler:
	  Fixed bug with lua-compiler script and the 'cbe' mode.
	  Fixed example compile/link commands in README.llvm-lua.
	* README.llvm-lua, llvm-lua/Makefile, llvm-lua/compile_all.sh,
	  llvm-lua/llvm_compiler.cpp, llvm-lua/llvm_compiler.h,
	  llvm-lua/lua-compiler:
	  Bump version to 1.0.
	  Add for information to README.llvm-lua
	  Fixed some bugs with embedding llvm-lua.
	  Added -help option to lua-compiler script.

2009-05-30  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/tests, llvm-lua/tests/NOTES, llvm-lua/tests/add.lua,
	  llvm-lua/tests/arg_test.lua, llvm-lua/tests/big_table.lua,
	  llvm-lua/tests/dump.lua, llvm-lua/tests/for.lua,
	  llvm-lua/tests/hash2.lua, llvm-lua/tests/loadk.lua,
	  llvm-lua/tests/local_nil.lua, llvm-lua/tests/loops.lua,
	  llvm-lua/tests/lua_tail.lua, llvm-lua/tests/nestedloop.lua,
	  llvm-lua/tests/nestedloop2.lua, llvm-lua/tests/nums.lua,
	  llvm-lua/tests/scimark_loop.lua, llvm-lua/tests/scimark_rand.lua,
	  llvm-lua/tests/stress_for.lua, llvm-lua/tests/test.lua,
	  llvm-lua/tests/test2.lua, llvm-lua/tests/test3.lua,
	  llvm-lua/tests/test4.lua, llvm-lua/tests/test_math.lua,
	  llvm-lua/tests/test_tail.lua:
	  Added lua scripts used for regression testing.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/TODO,
	  llvm-lua/llvm_lmathlib.c, llvm-lua/lua_core.c, src/lauxlib.c,
	  src/lauxlib.h, src/ldo.c:
	  Improved speed of math.* functions by lowering the call overhead.

2009-05-28  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp:
	  Fixed some bugs with numeric forloop optimizations.

2009-05-24  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/TODO, llvm-lua/lua-compiler, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops.h, llvm-lua/lua_vm_ops_static.c, src/ldo.c:
	  Improved performance of numeric for loops.

2009-05-21  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/llvm_dumper.cpp, llvm-lua/llvm_dumper.h,
	  llvm-lua/lua_compiler.c, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops.h, llvm-lua/lua_vm_ops_static.c,
	  llvm-lua/no_jit.c:
	  Added some optimizations.
	  Fixed a few bugs.

2009-05-20  Robert G. Jakabosky <bobby@neoawareness.com>

	* Makefile, llvm-lua/LLVMDumper.cpp, llvm-lua/Makefile,
	  llvm-lua/compile_all.sh, llvm-lua/lua-compiler,
	  llvm-lua/lua_compiler.c:
	  Fixed support for using c-backend to compile Lua scripts to
	  standalone binaries.
	* Makefile, llvm-lua/Makefile, llvm-lua/compile.sh,
	  llvm-lua/compile_all.sh, llvm-lua/llvm_compiler.h,
	  llvm-lua/lua-compiler:
	  Bump version number to 0.9
	  Cleaned up Makefile.
	  Renamed llvm-luac wrapper script from compile.sh to lua-compiler.
	* Makefile, README.llvm-lua, llvm-lua/LLVMDumper.cpp,
	  llvm-lua/Makefile, llvm-lua/bin2c.c, llvm-lua/compile.sh,
	  llvm-lua/llvm_compiler.cpp, llvm-lua/llvm_compiler.h,
	  llvm-lua/llvm_dumper.cpp, llvm-lua/llvm_dumper.h,
	  llvm-lua/load_embedded_bc.cpp, llvm-lua/load_embedded_bc.h,
	  llvm-lua/load_liblua_main.cpp, llvm-lua/load_liblua_main.h,
	  llvm-lua/load_vm_ops.cpp, llvm-lua/lua_vm_ops_module.cpp,
	  llvm-lua/lua_vm_ops_module.h:
	  Embedded lua_vm_ops.bc & liblua_main.bc instead of
	  loading/linking them at run-time.

2009-05-19  Robert G. Jakabosky <bobby@neoawareness.com>

	* Makefile, llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/Makefile, llvm-lua/TODO, llvm-lua/compile.sh,
	  llvm-lua/hook_parser.c, llvm-lua/load_jit_proto.c,
	  llvm-lua/load_jit_proto.h, llvm-lua/lua_main.c,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops.h,
	  llvm-lua/lua_vm_ops_static.c, llvm-lua/no_jit.c, src/ldo.c,
	  src/luaconf.h:
	  Fixed bugs with debug hooks.
	  Added line/upvalues/locals info to jit_proto, to support
	  debugging info of JITed code.
	  Allow debuging info be stripped when compling Lua scripts.

2009-05-17  Robert G. Jakabosky <bobby@neoawareness.com>

	* Makefile, etc/lua.pc, llvm-lua/LLVMCompiler.cpp,
	  llvm-lua/compile.sh, llvm-lua/load_vm_ops.cpp, src/ldebug.c:
	  Fixed compile bug.
	  Fixed lua debug libraries handling of JIT functions that have Lua
	  bytecode stripped.

2009-03-12  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/Makefile, llvm-lua/TODO, llvm-lua/compile.sh,
	  llvm-lua/compile_all.sh, llvm-lua/compile_bc.sh,
	  llvm-lua/compile_c.sh, llvm-lua/hook_parser.c,
	  llvm-lua/llvm-lua.cpp, llvm-lua/llvm-luac.cpp,
	  llvm-lua/llvm_compiler.cpp, llvm-lua/llvm_compiler.h,
	  llvm-lua/load_jit_proto.c, llvm-lua/load_jit_proto.h,
	  llvm-lua/lua_compiler.c, llvm-lua/lua_core.c,
	  llvm-lua/lua_main.c, llvm-lua/lua_vm_ops.h,
	  llvm-lua/lua_vm_ops_static.c:
	  Added support for stripping Lua opcodes from compiled Lua code
	  (can be used for obfucation).
	  Added support for compiling Lua code as native code modules
	  instead of just standalone binaries.
	  Added support for compiling llvm-lua as an embeddable library
	  with JIT support.
	  Improved compile.sh wrapper script.

2009-03-06  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/lua_vm_ops.c, src/lvm.c:
	  Fixed bug with Lua stack re-allocation.

2009-01-22  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/compile_c.sh, llvm-lua/llvm-lua.cpp,
	  llvm-lua/llvm-luac.cpp:
	  fixed bug with llvm asserts.
	  Added bash script for compiling lua scripts to C code.

2008-10-09  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/compile.sh, llvm-lua/compile_all.sh,
	  llvm-lua/compile_bc.sh:
	  compile llvm bitcode to assembly instead of 'C' code.

2008-10-08  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/compile.sh:
	  remove '-foptimize-sibling-calls'
	  disabled '-march=athlon64'
	* llvm-lua/llvm_compiler.h:
	  bump version to 0.5
	* src/ldo.h:
	  Added 'PCRTAILRECUR' for tail-recursive calls from JIT functions.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/compile.sh,
	  llvm-lua/hook_parser.c, llvm-lua/llvm-lua.cpp,
	  llvm-lua/llvm-luac.cpp, llvm-lua/llvm_compiler.cpp,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops_static.c:
	  Fixed memory offset bug & memory leaks.
	  Fixed '-time-passes' to display info about passes run by JIT.
	  Changed default Optimization level to '3'.

2008-10-07  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h, llvm-lua/TODO,
	  llvm-lua/compile.sh, llvm-lua/hook_parser.c,
	  llvm-lua/llvm-lua.cpp, llvm-lua/llvm-luac.cpp,
	  llvm-lua/llvm_compiler.cpp, llvm-lua/llvm_compiler.h,
	  llvm-lua/lua_compiler.c, llvm-lua/lua_main.c,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops.h,
	  llvm-lua/lua_vm_ops_static.c:
	  Added specialized functions for OP_EQ.
	  Added support to Lower for loop's internal idx variable from the
	  Lua stack to the c-stack.
	  Added support to remove "LOADK" opcodes used for constant for
	  loop parameters and turn then into llvm constants.
	  Added command-line options for controlling the optimization
	  level.
	  Fixed bug with passing command-line options to the Lua core
	  interpreter & compiler.

2008-10-05  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMDumper.cpp,
	  llvm-lua/lua_vm_ops_static.c:
	  Fixed a few bugs.
	  Improved tail-calls from JIT function to non-JIT Lua function.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/TODO, llvm-lua/llvm-lua.cpp,
	  llvm-lua/llvm-luac.cpp, llvm-lua/llvm_compiler.h:
	  Added LLVM command options to llvm-luac.
	  Don't compiled inlined opcode functions, since they will not be
	  called.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/Makefile, llvm-lua/compile.sh,
	  llvm-lua/hook_parser.c, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops.h, llvm-lua/lua_vm_ops_static.c, src/ldo.c,
	  src/ldo.h:
	  Fixed tail-call support, now lua scripts can make tail-calls
	  without the c-stack/lua callstack growing.
	  Added some optimizations of the Lua bytecode and generated
	  machine code.
	  Lowered the opcode limit from 800 down to 200 for the max
	  function size that is JITed.
	  Added support for specialized versions of each opcode function to
	  support more optimizations.

2008-10-03  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/lua_vm_ops.h, llvm-lua/lua_vm_ops_static.c:
	  remove unused argument.
	* llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/load_jit_proto.h, llvm-lua/lua_main.c:
	  Fixed 32bit support for static compiling Lua scripts.
	* Makefile, README.llvm-lua, llvm-lua/Makefile:
	  Improve Makefile support for other platforms.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/Makefile, llvm-lua/compile.sh, llvm-lua/compile_bc.sh,
	  llvm-lua/hook_parser.c, llvm-lua/llvm_compiler.cpp,
	  llvm-lua/llvm_compiler.h, llvm-lua/lua_core.c,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops.h,
	  llvm-lua/lua_vm_ops_static.c:
	  Improved true tailcall support when calling a JIT/C function from
	  a JIT function.
	  Removed 'func_state' structure from JIT functions to allow
	  tailcalls into vm_OP_* functions.
	* src/ldo.c, src/ldo.h, src/luaconf.h:
	  Export 'tryfuncTM' function as 'luaD_tryfuncTM' from ldo.c
	  disable HARDSTACKTESTS tests.

2008-09-29  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/Makefile, llvm-lua/compile.sh, llvm-lua/lua_compiler.h,
	  llvm-lua/lua_core.c, llvm-lua/lua_core.h, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops.h, llvm-lua/lua_vm_ops_module.cpp,
	  llvm-lua/lua_vm_ops_static.c:
	  Moved some large vm_OP_* functions from loadable bitcode file
	  into llvm-lua.
	  Added LLVM timers to compiler.
	  Added support for LLVM command line options.
	  Some code clean up.

2008-09-28  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/lua_vm_ops_module.cpp:
	  fixed compile bug.

2008-09-27  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/LLVMCompiler.cpp, llvm-lua/llvm-lua.cpp:
	  Add command line parsing support for LLVM options.
	* llvm-lua/load_vm_ops.cpp:
	  search current directory & LLVM_LIB_SEARCH_PATH for lua_vm_ops.bc
	  file.
	* llvm-lua/LLVMCompiler.cpp, llvm-lua/LLVMCompiler.h,
	  llvm-lua/LLVMDumper.cpp, llvm-lua/LLVMDumper.h,
	  llvm-lua/Makefile, llvm-lua/compile.sh, llvm-lua/hook_parser.c,
	  llvm-lua/llvm-compiler.cpp, llvm-lua/llvm-compiler.h,
	  llvm-lua/llvm-lua.cpp, llvm-lua/llvm-luac.cpp,
	  llvm-lua/llvm_compiler.cpp, llvm-lua/llvm_compiler.h,
	  llvm-lua/load_jit_proto.c, llvm-lua/load_vm_ops.cpp,
	  llvm-lua/load_vm_ops.h, llvm-lua/lua_compiler.c,
	  llvm-lua/lua_core.c, llvm-lua/lua_main.c, llvm-lua/lua_vm_ops.c,
	  llvm-lua/lua_vm_ops_module.cpp, llvm-lua/lua_vm_ops_module.h:
	  Added a new way to load the lua_vm_ops.bc by compiling it into
	  C++ LLVM API calls and embedding it into the llvm-lua & llvm-luac
	  programs.
	  Re-factored Lua bytecode to LLVM IR compiler code into two
	  classes LLVMCompiler & LLVMDumper.
	  Fixed some other bugs.

2008-09-23  Robert G. Jakabosky <bobby@neoawareness.com>

	* src/lcoco.c:
	  Mac OS X 64bit fix from Mike Pall

2008-09-19  Robert G. Jakabosky <bobby@neoawareness.com>

	* Makefile, doc/manual.html, doc/readme.html, etc/lua.pc,
	  src/lapi.c, src/loadlib.c, src/lobject.h, src/lstrlib.c,
	  src/lua.h:
	  Update to Official Lua-5.1.4

2008-08-30  Robert G. Jakabosky <bobby@neoawareness.com>

	* src/lcoco.c:
	  Changed from using %rbp & %rbx to %r12 & %r13 for wrap function.
	* llvm-lua/lua_vm_ops.c, src/lvm.c, src/lvm.h:
	  Fixed support for line/count debug hooks.
	* src/lcoco.c:
	  Added wrap function to set register %rdi (to lua_State *) on
	  first resume of a coroutine, instead of very resume/yield.

2008-08-28  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/llvm-compiler.cpp:
	  Patch from "Kay Ropke" fixes bug with compiling on OS X with the
	  latest LLVM revision(55456).

2008-08-27  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/llvm-compiler.cpp, llvm-lua/load_jit_proto.h:
	  fixed bug with boolean constants when static compiling Lua
	  scripts.

2008-08-26  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/compile_all.sh:
	  add message

2008-08-25  Robert G. Jakabosky <bobby@neoawareness.com>

	* llvm-lua/Makefile, llvm-lua/compile.sh, llvm-lua/compile_all.sh,
	  llvm-lua/hook_parser.c, llvm-lua/llvm-compiler.cpp,
	  llvm-lua/lua_vm_ops.c:
	  Fixed bugs with calling non-JITed Lua functions.
	  Manually inline opcode functions instead of using the inliner
	  pass.
	  Code cleanup.

2008-08-23  Robert G. Jakabosky <bobby@neoawareness.com>

	* src/lcoco.c:
	  fixed bug with assembly coco_switcher for x86_64.
	* src/Makefile, src/lcoco.c:
	  Added added assembly ctx_switcher for x86_64-linux to LuaCoco.
	* .svnignore, COPYRIGHT, HISTORY, INSTALL, Makefile, README,
	  README.llvm-lua, doc, doc/amazon.gif, doc/contents.html,
	  doc/cover.png, doc/logo.gif, doc/lua.1, doc/lua.css,
	  doc/lua.html, doc/luac.1, doc/luac.html, doc/manual.css,
	  doc/manual.html, doc/readme.html, etc, etc/Makefile, etc/README,
	  etc/all.c, etc/lua.hpp, etc/lua.ico, etc/lua.pc, etc/luavs.bat,
	  etc/min.c, etc/noparser.c, etc/strict.lua, llvm-lua,
	  llvm-lua/COPYRIGHT.llvm-lua, llvm-lua/Makefile,
	  llvm-lua/compile.sh, llvm-lua/hook_parser.c,
	  llvm-lua/llvm-compiler.cpp, llvm-lua/llvm-compiler.h,
	  llvm-lua/llvm-lua.cpp, llvm-lua/llvm-lua.h,
	  llvm-lua/llvm-luac.cpp, llvm-lua/llvm-luac.h,
	  llvm-lua/load_jit_proto.c, llvm-lua/load_jit_proto.h,
	  llvm-lua/lua_compiler.c, llvm-lua/lua_compiler.h,
	  llvm-lua/lua_core.c, llvm-lua/lua_core.h,
	  llvm-lua/lua_interpreter.c, llvm-lua/lua_interpreter.h,
	  llvm-lua/lua_main.c, llvm-lua/lua_normal.c,
	  llvm-lua/lua_vm_ops.c, llvm-lua/lua_vm_ops.h, src, src/Makefile,
	  src/lapi.c, src/lapi.h, src/lauxlib.c, src/lauxlib.h,
	  src/lbaselib.c, src/lcoco.c, src/lcoco.h, src/lcode.c,
	  src/lcode.h, src/ldblib.c, src/ldebug.c, src/ldebug.h, src/ldo.c,
	  src/ldo.h, src/ldump.c, src/lfunc.c, src/lfunc.h, src/lgc.c,
	  src/lgc.h, src/linit.c, src/liolib.c, src/llex.c, src/llex.h,
	  src/llimits.h, src/lmathlib.c, src/lmem.c, src/lmem.h,
	  src/loadlib.c, src/lobject.c, src/lobject.h, src/lopcodes.c,
	  src/lopcodes.h, src/loslib.c, src/lparser.c, src/lparser.h,
	  src/lstate.c, src/lstate.h, src/lstring.c, src/lstring.h,
	  src/lstrlib.c, src/ltable.c, src/ltable.h, src/ltablib.c,
	  src/ltm.c, src/ltm.h, src/lua.c, src/lua.h, src/luac.c,
	  src/luaconf.h, src/lualib.h, src/lundump.c, src/lundump.h,
	  src/lvm.c, src/lvm.h, src/lzio.c, src/lzio.h, src/print.c, test,
	  test/README, test/bisect.lua, test/cf.lua, test/echo.lua,
	  test/env.lua, test/factorial.lua, test/fib.lua, test/fibfor.lua,
	  test/globals.lua, test/hello.lua, test/life.lua, test/luac.lua,
	  test/printf.lua, test/readonly.lua, test/sieve.lua,
	  test/sort.lua, test/table.lua, test/trace-calls.lua,
	  test/trace-globals.lua, test/xd.lua:
	  Initial 0.1 release

2008-08-23  

	* .:
	  Initial directory structure.



================================================
FILE: HISTORY
================================================
HISTORY for Lua 5.1

* Changes from version 5.0 to 5.1
  -------------------------------
  Language:
  + new module system.
  + new semantics for control variables of fors.
  + new semantics for setn/getn.
  + new syntax/semantics for varargs.
  + new long strings and comments.
  + new `mod' operator (`%')
  + new length operator #t
  + metatables for all types
  API:
  + new functions: lua_createtable, lua_get(set)field, lua_push(to)integer.
  + user supplies memory allocator (lua_open becomes lua_newstate).
  + luaopen_* functions must be called through Lua.
  Implementation:
  + new configuration scheme via luaconf.h.
  + incremental garbage collection.
  + better handling of end-of-line in the lexer.
  + fully reentrant parser (new Lua function `load')
  + better support for 64-bit machines.
  + native loadlib support for Mac OS X.
  + standard distribution in only one library (lualib.a merged into lua.a)

* Changes from version 4.0 to 5.0
  -------------------------------
  Language:
  + lexical scoping.
  + Lua coroutines.
  + standard libraries now packaged in tables.
  + tags replaced by metatables and tag methods replaced by metamethods,
    stored in metatables.
  + proper tail calls.
  + each function can have its own global table, which can be shared.
  + new __newindex metamethod, called when we insert a new key into a table.
  + new block comments: --[[ ... ]].
  + new generic for.
  + new weak tables.
  + new boolean type.
  + new syntax "local function".
  + (f()) returns the first value returned by f.
  + {f()} fills a table with all values returned by f.
  + \n ignored in [[\n .
  + fixed and-or priorities.
  + more general syntax for function definition (e.g. function a.x.y:f()...end).
  + more general syntax for function calls (e.g. (print or write)(9)).
  + new functions (time/date, tmpfile, unpack, require, load*, etc.).
  API:
  + chunks are loaded by using lua_load; new luaL_loadfile and luaL_loadbuffer.
  + introduced lightweight userdata, a simple "void*" without a metatable.
  + new error handling protocol: the core no longer prints error messages;
    all errors are reported to the caller on the stack.
  + new lua_atpanic for host cleanup.
  + new, signal-safe, hook scheme.
  Implementation:
  + new license: MIT.
  + new, faster, register-based virtual machine.
  + support for external multithreading and coroutines.
  + new and consistent error message format.
  + the core no longer needs "stdio.h" for anything (except for a single
    use of sprintf to convert numbers to strings).
  + lua.c now runs the environment variable LUA_INIT, if present. It can
    be "@filename", to run a file, or the chunk itself.
  + support for user extensions in lua.c.
    sample implementation given for command line editing.
  + new dynamic loading library, active by default on several platforms.
  + safe garbage-collector metamethods.
  + precompiled bytecodes checked for integrity (secure binary dostring).
  + strings are fully aligned.
  + position capture in string.find.
  + read('*l') can read lines with embedded zeros.

* Changes from version 3.2 to 4.0
  -------------------------------
  Language:
  + new "break" and "for" statements (both numerical and for tables).
  + uniform treatment of globals: globals are now stored in a Lua table.
  + improved error messages.
  + no more '$debug': full speed *and* full debug information.
  + new read form: read(N) for next N bytes.
  + general read patterns now deprecated.
    (still available with -DCOMPAT_READPATTERNS.)
  + all return values are passed as arguments for the last function
    (old semantics still available with -DLUA_COMPAT_ARGRET)
  + garbage collection tag methods for tables now deprecated.
  + there is now only one tag method for order.
  API:
  + New API: fully re-entrant, simpler, and more efficient.
  + New debug API.
  Implementation:
  + faster than ever: cleaner virtual machine and new hashing algorithm.
  + non-recursive garbage-collector algorithm.
  + reduced memory usage for programs with many strings.
  + improved treatment for memory allocation errors.
  + improved support for 16-bit machines (we hope).
  + code now compiles unmodified as both ANSI C and C++.
  + numbers in bases other than 10 are converted using strtoul.
  + new -f option in Lua to support #! scripts.
  + luac can now combine text and binaries.

* Changes from version 3.1 to 3.2
  -------------------------------
  + redirected all output in Lua's core to _ERRORMESSAGE and _ALERT.
  + increased limit on the number of constants and globals per function
    (from 2^16 to 2^24).
  + debugging info (lua_debug and hooks) moved into lua_state and new API
    functions provided to get and set this info.
  + new debug lib gives full debugging access within Lua.
  + new table functions "foreachi", "sort", "tinsert", "tremove", "getn".
  + new io functions "flush", "seek".

* Changes from version 3.0 to 3.1
  -------------------------------
  + NEW FEATURE: anonymous functions with closures (via "upvalues").
  + new syntax:
    - local variables in chunks.
    - better scope control with DO block END.
    - constructors can now be also written: { record-part; list-part }.
    - more general syntax for function calls and lvalues, e.g.:
      f(x).y=1
      o:f(x,y):g(z)
      f"string" is sugar for f("string")
  + strings may now contain arbitrary binary data (e.g., embedded zeros).
  + major code re-organization and clean-up; reduced module interdependecies.
  + no arbitrary limits on the total number of constants and globals.
  + support for multiple global contexts.
  + better syntax error messages.
  + new traversal functions "foreach" and "foreachvar".
  + the default for numbers is now double.
    changing it to use floats or longs is easy.
  + complete debug information stored in pre-compiled chunks.
  + sample interpreter now prompts user when run interactively, and also
    handles control-C interruptions gracefully.

* Changes from version 2.5 to 3.0
  -------------------------------
  + NEW CONCEPT: "tag methods".
    Tag methods replace fallbacks as the meta-mechanism for extending the
    semantics of Lua. Whereas fallbacks had a global nature, tag methods
    work on objects having the same tag (e.g., groups of tables).
    Existing code that uses fallbacks should work without change.
  + new, general syntax for constructors {[exp] = exp, ... }.
  + support for handling variable number of arguments in functions (varargs).
  + support for conditional compilation ($if ... $else ... $end).
  + cleaner semantics in API simplifies host code.
  + better support for writing libraries (auxlib.h).
  + better type checking and error messages in the standard library.
  + luac can now also undump.

* Changes from version 2.4 to 2.5
  -------------------------------
  + io and string libraries are now based on pattern matching;
    the old libraries are still available for compatibility
  + dofile and dostring can now return values (via return statement)
  + better support for 16- and 64-bit machines
  + expanded documentation, with more examples

* Changes from version 2.2 to 2.4
  -------------------------------
  + external compiler creates portable binary files that can be loaded faster
  + interface for debugging and profiling
  + new "getglobal" fallback
  + new functions for handling references to Lua objects
  + new functions in standard lib
  + only one copy of each string is stored
  + expanded documentation, with more examples

* Changes from version 2.1 to 2.2
  -------------------------------
  + functions now may be declared with any "lvalue" as a name
  + garbage collection of functions
  + support for pipes

* Changes from version 1.1 to 2.1
  -------------------------------
  + object-oriented support
  + fallbacks
  + simplified syntax for tables
  + many internal improvements

(end of HISTORY)


================================================
FILE: INSTALL
================================================
INSTALL for Lua 5.1

* Building Lua
  ------------
  Lua is built in the src directory, but the build process can be
  controlled from the top-level Makefile.

  Building Lua on Unix systems should be very easy. First do "make" and
  see if your platform is listed. If so, just do "make xxx", where xxx
  is your platform name. The platforms currently supported are:
    aix ansi bsd freebsd generic linux macosx mingw posix solaris

  If your platform is not listed, try the closest one or posix, generic,
  ansi, in this order.

  See below for customization instructions and for instructions on how
  to build with other Windows compilers.

  If you want to check that Lua has been built correctly, do "make test"
  after building Lua. Also, have a look at the example programs in test.

* Installing Lua
  --------------
  Once you have built Lua, you may want to install it in an official
  place in your system. In this case, do "make install". The official
  place and the way to install files are defined in Makefile. You must
  have the right permissions to install files.

  If you want to build and install Lua in one step, do "make xxx install",
  where xxx is your platform name.

  If you want to install Lua locally, then do "make local". This will
  create directories bin, include, lib, man, and install Lua there as
  follows:

    bin:	lua luac
    include:	lua.h luaconf.h lualib.h lauxlib.h lua.hpp
    lib:	liblua.a
    man/man1:	lua.1 luac.1

  These are the only directories you need for development.

  There are man pages for lua and luac, in both nroff and html, and a
  reference manual in html in doc, some sample code in test, and some
  useful stuff in etc. You don't need these directories for development.

  If you want to install Lua locally, but in some other directory, do
  "make install INSTALL_TOP=xxx", where xxx is your chosen directory.

  See below for instructions for Windows and other systems.

* Customization
  -------------
  Three things can be customized by editing a file:
    - Where and how to install Lua -- edit Makefile.
    - How to build Lua -- edit src/Makefile.
    - Lua features -- edit src/luaconf.h.

  You don't actually need to edit the Makefiles because you may set the
  relevant variables when invoking make.

  On the other hand, if you need to select some Lua features, you'll need
  to edit src/luaconf.h. The edited file will be the one installed, and
  it will be used by any Lua clients that you build, to ensure consistency.

  We strongly recommend that you enable dynamic loading. This is done
  automatically for all platforms listed above that have this feature
  (and also Windows). See src/luaconf.h and also src/Makefile.

* Building Lua on Windows and other systems
  -----------------------------------------
  If you're not using the usual Unix tools, then the instructions for
  building Lua depend on the compiler you use. You'll need to create
  projects (or whatever your compiler uses) for building the library,
  the interpreter, and the compiler, as follows:

  library:	lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
		lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c
		ltable.c ltm.c lundump.c lvm.c lzio.c
		lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
		ltablib.c lstrlib.c loadlib.c linit.c

  interpreter:	library, lua.c

  compiler:	library, luac.c print.c

  If you use Visual Studio .NET, you can use etc/luavs.bat in its
  "Command Prompt".

  If all you want is to build the Lua interpreter, you may put all .c files
  in a single project, except for luac.c and print.c. Or just use etc/all.c.

  To use Lua as a library in your own programs, you'll need to know how to
  create and use libraries with your compiler.

  As mentioned above, you may edit luaconf.h to select some features before
  building Lua.

(end of INSTALL)


================================================
FILE: README
================================================
README for Lua 5.1

See INSTALL for installation instructions.
See HISTORY for a summary of changes since the last released version.

* What is Lua?
  ------------
  Lua is a powerful, light-weight programming language designed for extending
  applications. Lua is also frequently used as a general-purpose, stand-alone
  language. Lua is free software.

  For complete information, visit Lua's web site at http://www.lua.org/ .
  For an executive summary, see http://www.lua.org/about.html .

  Lua has been used in many different projects around the world.
  For a short list, see http://www.lua.org/uses.html .

* Availability
  ------------
  Lua is freely available for both academic and commercial purposes.
  See COPYRIGHT and http://www.lua.org/license.html for details.
  Lua can be downloaded at http://www.lua.org/download.html .

* Installation
  ------------
  Lua is implemented in pure ANSI C, and compiles unmodified in all known
  platforms that have an ANSI C compiler. In most Unix-like platforms, simply
  do "make" with a suitable target. See INSTALL for detailed instructions.

* Origin
  ------
  Lua is developed at Lua.org, a laboratory of the Department of Computer
  Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro
  in Brazil).
  For more information about the authors, see http://www.lua.org/authors.html .

(end of README)


================================================
FILE: README.llvm-lua
================================================
README for llvm-lua

=== Requires ===
 * LLVM 2.8
 * Clang or llvm-gcc 4.2.x from llvm.org

=== Compile ===
 * mkdir build
 * cd build
 for Release build:
 * cmake .. -DLLVM_PATH=<path to llvm+clan> -DCMAKE_BUILD_TYPE=Release
 for Debug build:
 * cmake .. -DLLVM_PATH=<path to llvm+clan> -DCMAKE_BUILD_TYPE=Debug
 * make

=== Install ===
 * make install

=== Patches to lua/src ===
 * Emergency Garbage Collector: http://lua-users.org/wiki/EmergencyGarbageCollector
 * LuaCoco-1.1.6: http://luajit.org/coco.html + (x86_64 support added)
 * a few hooks where added to support JIT compiled functions.

=== Programs ===
 * llvm-lua: This command can be used to run Lua script.  It uses the LLVM backend to JIT Lua scripts to machine code for faster execution.
 * llvm-luac: This command compiles Lua scripts into LLVM bitcode.
 * lua-compiler: This is a bash script that wraps llvm-luac to compile Lua scripts into standalone executables or loadable modules.

=== Libraries ===
 -- Lua core without LLVM JIT support, but compatible with compiled modules.  Can be used as drop-in replacements of the normal Lua libraries.
 * liblua_static.a & liblua.so

 -- Static library with LLVM JIT support requires static linking with LLVM libraries.
 * libllvm-lua_static.a & libllvm-lua.so

 -- Used for compling Lua scripts to standalone executables.
 * liblua_main.a

=== Using llvm-lua ===
The JIT/interpreter command 'llvm-lua' can be used just like the normal 'lua'.  There are a lot of extra command line options that expose some options from LLVM, they are not required for normal use.  The JIT will compile Lua code with optimization level 3 by default.

=== Static compiling Lua scripts ===
'llvm-luac' alone can only compile Lua scripts to Lua bytecode or LLVM bitcode.  A wrapper script called 'lua-compiler' is provided that wraps 'llvm-luac', the LLVM tools (llc & opt), and gcc.

Compile standalone Lua script:
lua-compiler script.lua
outputs: ./script

Compile Lua script as a module:
lua-compiler -lua-module script.lua
outputs: ./script.so

=== Embedding 'llvm-lua' with JIT support ===
The Lua C API is unchanged and no extra API functions are exposed by llvm-lua.  The only change is how host app. is linked with the 'liblua-llvm.a' library instead of the normal 'liblua.a' library.

Use the following command to link your C app with llvm-lua:
gcc -o embed.o -c etc/embed_jit.c
g++ -o embed embed.o -lllvm-lua `llvm-config --ldflags --libs core jit native linker` -rdynamic -Wl,-E -lm -ldl

Use the following command to link your C++ app with llvm-lua:
g++ -o embed.o -c etc/embed_jit.cpp
g++ -o embed embed.o -lllvm-lua `llvm-config --ldflags --libs core jit native linker` -rdynamic -Wl,-E -lm -ldl



================================================
FILE: TODO
================================================
-- TODO list

misc:
* Port lua-compiler bash script to a Lua script.
* handle coroutine c-stack alignment issues on x86_64 when compiling in DEBUG mode.
* Add option to compile liblua_main.a without lua parser, lundump/ldump code.
* Update to latest EGC patch.

module naming issues:
* change how the compiler names modules.
* give the compiler a search path + module name "A.B.C" and have it compile A/B/C.lua into A/B/C.so
* remove output file extension when nameing the module, instead of just the last three letters.

lua-compiler script:
* fix linking bug reported by DigitalKiwi:
 <DigitalKiwi> #CFLAGS=" -ggdb -O3 -fomit-frame-pointer -pipe -Wall "
 <DigitalKiwi> CFLAGS=" -O3 -fomit-frame-pointer -pipe -Wl,-E "
 <DigitalKiwi> http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/install.html



================================================
FILE: cmake/CustomMacros.cmake
================================================

macro(add_llvm_bc_library _target)
	set(_llvm_cflags)
	get_property(_idirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
	foreach(_idir ${_idirs})
		set(_llvm_cflags ${_llvm_cflags} -I${_idir})
	endforeach(_idir)

	if(${ARGC} GREATER 2)
		set(_bc_files)
		foreach(_file ${ARGN})
			set(_bc_file "${CMAKE_CURRENT_BINARY_DIR}/${_file}.bc")
			set(_bc_files ${_bc_files} ${_bc_file})
			add_custom_command(OUTPUT ${_bc_file}
				COMMAND ${LLVM_CC} ARGS ${BC_CFLAGS} ${_llvm_cflags} -o ${_bc_file} ${_file}
				WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
				DEPENDS ${_file}
			)
		endforeach(_file)
		add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.bc
			COMMAND ${LLVM_LD} ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/${_target}.bc ${_bc_files}
			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
			DEPENDS ${_bc_files}
		)
	else(${ARGC} GREATER 2)
		add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.bc
			COMMAND ${LLVM_CC} ARGS ${BC_CFLAGS} ${_llvm_cflags} -o ${CMAKE_CURRENT_BINARY_DIR}/${_target}.bc ${ARGV1}
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
			DEPENDS ${ARGV1}
		)
	endif(${ARGC} GREATER 2)
endmacro(add_llvm_bc_library)

macro(add_target_properties _target _name)
	set(_properties)
	foreach(_prop ${ARGN})
		set(_properties "${_properties} ${_prop}")
	endforeach(_prop)
	get_target_property(_old_properties ${_target} ${_name})
	if(NOT _old_properties)
		# in case it's NOTFOUND
		set(_old_properties)
	endif(NOT _old_properties)
	set_target_properties(${_target} PROPERTIES ${_name} "${_old_properties} ${_properties}")
endmacro(add_target_properties)



================================================
FILE: cmake/FindLLVM.cmake
================================================
# - Find libev
# Find the native LLVM includes and library
#
#  LLVM_INCLUDE_DIR - where to find ev.h, etc.
#  LLVM_LIBRARIES   - List of libraries when using libev.
#  LLVM_FOUND       - True if libev found.

find_program(LLVM_CONFIG_EXECUTABLE NAMES "${LLVM_PATH}/bin/llvm-config" DOC "llvm-config executable")

execute_process(
	COMMAND ${LLVM_CONFIG_EXECUTABLE} --cppflags
	OUTPUT_VARIABLE LLVM_CFLAGS
	OUTPUT_STRIP_TRAILING_WHITESPACE
)

execute_process(
	COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags
	OUTPUT_VARIABLE LLVM_LFLAGS
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
	COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs core jit native linker bitreader bitwriter ipo
	OUTPUT_VARIABLE LLVM_JIT_LIBS
	OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
	COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs all
	OUTPUT_VARIABLE LLVM_ALL_LIBS
	OUTPUT_STRIP_TRAILING_WHITESPACE
)



================================================
FILE: cmake_uninstall.cmake.in
================================================
IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
  MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")

FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
  MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
  EXEC_PROGRAM(
    "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
    OUTPUT_VARIABLE rm_out
    RETURN_VALUE rm_retval
    )
  IF(NOT "${rm_retval}" STREQUAL 0)
    MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
  ENDIF(NOT "${rm_retval}" STREQUAL 0)
ENDFOREACH(file)



================================================
FILE: doc/contents.html
================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Lua 5.1 Reference Manual - contents</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
<STYLE TYPE="text/css">
ul {
	list-style-type: none ;
	list-style-position: outside ;
}
</STYLE>
</HEAD>

<BODY>

<HR>
<H1>
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="" BORDER=0></A>
Lua 5.1 Reference Manual
</H1>

This is an online version of
<BLOCKQUOTE>
<A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
<IMG SRC="cover.png" ALT="" TITLE="buy from Amazon" BORDER=1 ALIGN="left" HSPACE=12>
</A>
<B>Lua 5.1 Reference Manual</B>
<BR>by R. Ierusalimschy, L. H. de Figueiredo, W. Celes
<BR>Lua.org, August 2006
<BR>ISBN 85-903798-3-3
<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/8590379833/lua-indexmanual-20">
<IMG SRC="amazon.gif" ALT="[Buy from Amazon]" BORDER=0></A>
<BR CLEAR="all">
</BLOCKQUOTE>
<P>

Buy a copy of this book and 
<A HREF="http://www.lua.org/donations.html">help to support</A>
the Lua project.
<P>

The reference manual is the official definition of the Lua language.
For a complete introduction to Lua programming, see the book
<A HREF="http://www.lua.org/docs.html#books">Programming in Lua</A>.
<P>

<A HREF="manual.html">start</A>
&middot;
<A HREF="#contents">contents</A>
&middot;
<A HREF="#index">index</A>
&middot;
<A HREF="http://www.lua.org/manual/5.1/pt/">portugus</A>
&middot;
<A HREF="http://www.lua.org/manual/5.1/es/">espaol</A>
<HR>
<SMALL>
Copyright &copy; 2006-2008 Lua.org, PUC-Rio.
Freely available under the terms of the
<a href="http://www.lua.org/license.html#5">Lua license</a>.
</SMALL>
<P>

<H2><A NAME="contents">Contents</A></H2>
<UL style="padding: 0">
<LI><A HREF="manual.html">1 - Introduction</A>
<P>
<LI><A HREF="manual.html#2">2 - The Language</A>
<UL>
<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>
<LI><A HREF="manual.html#2.2">2.2 - Values and Types</A>
<UL>
<LI><A HREF="manual.html#2.2.1">2.2.1 - Coercion</A>
</UL>
<LI><A HREF="manual.html#2.3">2.3 - Variables</A>
<LI><A HREF="manual.html#2.4">2.4 - Statements</A>
<UL>
<LI><A HREF="manual.html#2.4.1">2.4.1 - Chunks</A>
<LI><A HREF="manual.html#2.4.2">2.4.2 - Blocks</A>
<LI><A HREF="manual.html#2.4.3">2.4.3 - Assignment</A>
<LI><A HREF="manual.html#2.4.4">2.4.4 - Control Structures</A>
<LI><A HREF="manual.html#2.4.5">2.4.5 - For Statement</A>
<LI><A HREF="manual.html#2.4.6">2.4.6 - Function Calls as Statements</A>
<LI><A HREF="manual.html#2.4.7">2.4.7 - Local Declarations</A>
</UL>
<LI><A HREF="manual.html#2.5">2.5 - Expressions</A>
<UL>
<LI><A HREF="manual.html#2.5.1">2.5.1 - Arithmetic Operators</A>
<LI><A HREF="manual.html#2.5.2">2.5.2 - Relational Operators</A>
<LI><A HREF="manual.html#2.5.3">2.5.3 - Logical Operators</A>
<LI><A HREF="manual.html#2.5.4">2.5.4 - Concatenation</A>
<LI><A HREF="manual.html#2.5.5">2.5.5 - The Length Operator</A>
<LI><A HREF="manual.html#2.5.6">2.5.6 - Precedence</A>
<LI><A HREF="manual.html#2.5.7">2.5.7 - Table Constructors</A>
<LI><A HREF="manual.html#2.5.8">2.5.8 - Function Calls</A>
<LI><A HREF="manual.html#2.5.9">2.5.9 - Function Definitions</A>
</UL>
<LI><A HREF="manual.html#2.6">2.6 - Visibility Rules</A>
<LI><A HREF="manual.html#2.7">2.7 - Error Handling</A>
<LI><A HREF="manual.html#2.8">2.8 - Metatables</A>
<LI><A HREF="manual.html#2.9">2.9 - Environments</A>
<LI><A HREF="manual.html#2.10">2.10 - Garbage Collection</A>
<UL>
<LI><A HREF="manual.html#2.10.1">2.10.1 - Garbage-Collection Metamethods</A>
<LI><A HREF="manual.html#2.10.2">2.10.2 - Weak Tables</A>
</UL>
<LI><A HREF="manual.html#2.11">2.11 - Coroutines</A>
</UL>
<P>
<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>
<UL>
<LI><A HREF="manual.html#3.1">3.1 - The Stack</A>
<LI><A HREF="manual.html#3.2">3.2 - Stack Size</A>
<LI><A HREF="manual.html#3.3">3.3 - Pseudo-Indices</A>
<LI><A HREF="manual.html#3.4">3.4 - C Closures</A>
<LI><A HREF="manual.html#3.5">3.5 - Registry</A>
<LI><A HREF="manual.html#3.6">3.6 - Error Handling in C</A>
<LI><A HREF="manual.html#3.7">3.7 - Functions and Types</A>
<LI><A HREF="manual.html#3.8">3.8 - The Debug Interface</A>
</UL>
<P>
<LI><A HREF="manual.html#4">4 - The Auxiliary Library</A>
<UL>
<LI><A HREF="manual.html#4.1">4.1 - Functions and Types</A>
</UL>
<P>
<LI><A HREF="manual.html#5">5 - Standard Libraries</A>
<UL>
<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>
<LI><A HREF="manual.html#5.2">5.2 - Coroutine Manipulation</A>
<LI><A HREF="manual.html#5.3">5.3 - Modules</A>
<LI><A HREF="manual.html#5.4">5.4 - String Manipulation</A>
<UL>
<LI><A HREF="manual.html#5.4.1">5.4.1 - Patterns</A>
</UL>
<LI><A HREF="manual.html#5.5">5.5 - Table Manipulation</A>
<LI><A HREF="manual.html#5.6">5.6 - Mathematical Functions</A>
<LI><A HREF="manual.html#5.7">5.7 - Input and Output Facilities</A>
<LI><A HREF="manual.html#5.8">5.8 - Operating System Facilities</A>
<LI><A HREF="manual.html#5.9">5.9 - The Debug Library</A>
</UL>
<P>
<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>
<P>
<LI><A HREF="manual.html#7">7 - Incompatibilities with the Previous Version</A>
<UL>
<LI><A HREF="manual.html#7.1">7.1 - Changes in the Language</A>
<LI><A HREF="manual.html#7.2">7.2 - Changes in the Libraries</A>
<LI><A HREF="manual.html#7.3">7.3 - Changes in the API</A>
</UL>
<P>
<LI><A HREF="manual.html#8">8 - The Complete Syntax of Lua</A>
</UL>

<H2><A NAME="index">Index</A></H2>
<TABLE WIDTH="100%">
<TR VALIGN="top">
<TD>
<H3><A NAME="functions">Lua functions</A></H3>
<A HREF="manual.html#pdf-_G">_G</A><BR>
<A HREF="manual.html#pdf-_VERSION">_VERSION</A><BR>
<A HREF="manual.html#pdf-assert">assert</A><BR>
<A HREF="manual.html#pdf-collectgarbage">collectgarbage</A><BR>
<A HREF="manual.html#pdf-dofile">dofile</A><BR>
<A HREF="manual.html#pdf-error">error</A><BR>
<A HREF="manual.html#pdf-getfenv">getfenv</A><BR>
<A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR>
<A HREF="manual.html#pdf-ipairs">ipairs</A><BR>
<A HREF="manual.html#pdf-load">load</A><BR>
<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
<A HREF="manual.html#pdf-loadstring">loadstring</A><BR>
<A HREF="manual.html#pdf-module">module</A><BR>
<A HREF="manual.html#pdf-next">next</A><BR>
<A HREF="manual.html#pdf-pairs">pairs</A><BR>
<A HREF="manual.html#pdf-pcall">pcall</A><BR>
<A HREF="manual.html#pdf-print">print</A><BR>
<A HREF="manual.html#pdf-rawequal">rawequal</A><BR>
<A HREF="manual.html#pdf-rawget">rawget</A><BR>
<A HREF="manual.html#pdf-rawset">rawset</A><BR>
<A HREF="manual.html#pdf-require">require</A><BR>
<A HREF="manual.html#pdf-select">select</A><BR>
<A HREF="manual.html#pdf-setfenv">setfenv</A><BR>
<A HREF="manual.html#pdf-setmetatable">setmetatable</A><BR>
<A HREF="manual.html#pdf-tonumber">tonumber</A><BR>
<A HREF="manual.html#pdf-tostring">tostring</A><BR>
<A HREF="manual.html#pdf-type">type</A><BR>
<A HREF="manual.html#pdf-unpack">unpack</A><BR>
<A HREF="manual.html#pdf-xpcall">xpcall</A><BR>
<P>

<A HREF="manual.html#pdf-coroutine.create">coroutine.create</A><BR>
<A HREF="manual.html#pdf-coroutine.resume">coroutine.resume</A><BR>
<A HREF="manual.html#pdf-coroutine.running">coroutine.running</A><BR>
<A HREF="manual.html#pdf-coroutine.status">coroutine.status</A><BR>
<A HREF="manual.html#pdf-coroutine.wrap">coroutine.wrap</A><BR>
<A HREF="manual.html#pdf-coroutine.yield">coroutine.yield</A><BR>
<P>

<A HREF="manual.html#pdf-debug.debug">debug.debug</A><BR>
<A HREF="manual.html#pdf-debug.getfenv">debug.getfenv</A><BR>
<A HREF="manual.html#pdf-debug.gethook">debug.gethook</A><BR>
<A HREF="manual.html#pdf-debug.getinfo">debug.getinfo</A><BR>
<A HREF="manual.html#pdf-debug.getlocal">debug.getlocal</A><BR>
<A HREF="manual.html#pdf-debug.getmetatable">debug.getmetatable</A><BR>
<A HREF="manual.html#pdf-debug.getregistry">debug.getregistry</A><BR>
<A HREF="manual.html#pdf-debug.getupvalue">debug.getupvalue</A><BR>
<A HREF="manual.html#pdf-debug.setfenv">debug.setfenv</A><BR>
<A HREF="manual.html#pdf-debug.sethook">debug.sethook</A><BR>
<A HREF="manual.html#pdf-debug.setlocal">debug.setlocal</A><BR>
<A HREF="manual.html#pdf-debug.setmetatable">debug.setmetatable</A><BR>
<A HREF="manual.html#pdf-debug.setupvalue">debug.setupvalue</A><BR>
<A HREF="manual.html#pdf-debug.traceback">debug.traceback</A><BR>

</TD>
<TD>
<H3>&nbsp;</H3>
<A HREF="manual.html#pdf-file:close">file:close</A><BR>
<A HREF="manual.html#pdf-file:flush">file:flush</A><BR>
<A HREF="manual.html#pdf-file:lines">file:lines</A><BR>
<A HREF="manual.html#pdf-file:read">file:read</A><BR>
<A HREF="manual.html#pdf-file:seek">file:seek</A><BR>
<A HREF="manual.html#pdf-file:setvbuf">file:setvbuf</A><BR>
<A HREF="manual.html#pdf-file:write">file:write</A><BR>
<P>

<A HREF="manual.html#pdf-io.close">io.close</A><BR>
<A HREF="manual.html#pdf-io.flush">io.flush</A><BR>
<A HREF="manual.html#pdf-io.input">io.input</A><BR>
<A HREF="manual.html#pdf-io.lines">io.lines</A><BR>
<A HREF="manual.html#pdf-io.open">io.open</A><BR>
<A HREF="manual.html#pdf-io.output">io.output</A><BR>
<A HREF="manual.html#pdf-io.popen">io.popen</A><BR>
<A HREF="manual.html#pdf-io.read">io.read</A><BR>
<A HREF="manual.html#pdf-io.stderr">io.stderr</A><BR>
<A HREF="manual.html#pdf-io.stdin">io.stdin</A><BR>
<A HREF="manual.html#pdf-io.stdout">io.stdout</A><BR>
<A HREF="manual.html#pdf-io.tmpfile">io.tmpfile</A><BR>
<A HREF="manual.html#pdf-io.type">io.type</A><BR>
<A HREF="manual.html#pdf-io.write">io.write</A><BR>
<P>

<A HREF="manual.html#pdf-math.abs">math.abs</A><BR>
<A HREF="manual.html#pdf-math.acos">math.acos</A><BR>
<A HREF="manual.html#pdf-math.asin">math.asin</A><BR>
<A HREF="manual.html#pdf-math.atan">math.atan</A><BR>
<A HREF="manual.html#pdf-math.atan2">math.atan2</A><BR>
<A HREF="manual.html#pdf-math.ceil">math.ceil</A><BR>
<A HREF="manual.html#pdf-math.cos">math.cos</A><BR>
<A HREF="manual.html#pdf-math.cosh">math.cosh</A><BR>
<A HREF="manual.html#pdf-math.deg">math.deg</A><BR>
<A HREF="manual.html#pdf-math.exp">math.exp</A><BR>
<A HREF="manual.html#pdf-math.floor">math.floor</A><BR>
<A HREF="manual.html#pdf-math.fmod">math.fmod</A><BR>
<A HREF="manual.html#pdf-math.frexp">math.frexp</A><BR>
<A HREF="manual.html#pdf-math.huge">math.huge</A><BR>
<A HREF="manual.html#pdf-math.ldexp">math.ldexp</A><BR>
<A HREF="manual.html#pdf-math.log">math.log</A><BR>
<A HREF="manual.html#pdf-math.log10">math.log10</A><BR>
<A HREF="manual.html#pdf-math.max">math.max</A><BR>
<A HREF="manual.html#pdf-math.min">math.min</A><BR>
<A HREF="manual.html#pdf-math.modf">math.modf</A><BR>
<A HREF="manual.html#pdf-math.pi">math.pi</A><BR>
<A HREF="manual.html#pdf-math.pow">math.pow</A><BR>
<A HREF="manual.html#pdf-math.rad">math.rad</A><BR>
<A HREF="manual.html#pdf-math.random">math.random</A><BR>
<A HREF="manual.html#pdf-math.randomseed">math.randomseed</A><BR>
<A HREF="manual.html#pdf-math.sin">math.sin</A><BR>
<A HREF="manual.html#pdf-math.sinh">math.sinh</A><BR>
<A HREF="manual.html#pdf-math.sqrt">math.sqrt</A><BR>
<A HREF="manual.html#pdf-math.tan">math.tan</A><BR>
<A HREF="manual.html#pdf-math.tanh">math.tanh</A><BR>
<P>

<A HREF="manual.html#pdf-os.clock">os.clock</A><BR>
<A HREF="manual.html#pdf-os.date">os.date</A><BR>
<A HREF="manual.html#pdf-os.difftime">os.difftime</A><BR>
<A HREF="manual.html#pdf-os.execute">os.execute</A><BR>
<A HREF="manual.html#pdf-os.exit">os.exit</A><BR>
<A HREF="manual.html#pdf-os.getenv">os.getenv</A><BR>
<A HREF="manual.html#pdf-os.remove">os.remove</A><BR>
<A HREF="manual.html#pdf-os.rename">os.rename</A><BR>
<A HREF="manual.html#pdf-os.setlocale">os.setlocale</A><BR>
<A HREF="manual.html#pdf-os.time">os.time</A><BR>
<A HREF="manual.html#pdf-os.tmpname">os.tmpname</A><BR>
<P>

<A HREF="manual.html#pdf-package.cpath">package.cpath</A><BR>
<A HREF="manual.html#pdf-package.loaded">package.loaded</A><BR>
<A HREF="manual.html#pdf-package.loaders">package.loaders</A><BR>
<A HREF="manual.html#pdf-package.loadlib">package.loadlib</A><BR>
<A HREF="manual.html#pdf-package.path">package.path</A><BR>
<A HREF="manual.html#pdf-package.preload">package.preload</A><BR>
<A HREF="manual.html#pdf-package.seeall">package.seeall</A><BR>
<P>

<A HREF="manual.html#pdf-string.byte">string.byte</A><BR>
<A HREF="manual.html#pdf-string.char">string.char</A><BR>
<A HREF="manual.html#pdf-string.dump">string.dump</A><BR>
<A HREF="manual.html#pdf-string.find">string.find</A><BR>
<A HREF="manual.html#pdf-string.format">string.format</A><BR>
<A HREF="manual.html#pdf-string.gmatch">string.gmatch</A><BR>
<A HREF="manual.html#pdf-string.gsub">string.gsub</A><BR>
<A HREF="manual.html#pdf-string.len">string.len</A><BR>
<A HREF="manual.html#pdf-string.lower">string.lower</A><BR>
<A HREF="manual.html#pdf-string.match">string.match</A><BR>
<A HREF="manual.html#pdf-string.rep">string.rep</A><BR>
<A HREF="manual.html#pdf-string.reverse">string.reverse</A><BR>
<A HREF="manual.html#pdf-string.sub">string.sub</A><BR>
<A HREF="manual.html#pdf-string.upper">string.upper</A><BR>
<P>

<A HREF="manual.html#pdf-table.concat">table.concat</A><BR>
<A HREF="manual.html#pdf-table.insert">table.insert</A><BR>
<A HREF="manual.html#pdf-table.maxn">table.maxn</A><BR>
<A HREF="manual.html#pdf-table.remove">table.remove</A><BR>
<A HREF="manual.html#pdf-table.sort">table.sort</A><BR>

</TD>
<TD>
<H3>C API</H3>
<A HREF="manual.html#lua_Alloc">lua_Alloc</A><BR>
<A HREF="manual.html#lua_CFunction">lua_CFunction</A><BR>
<A HREF="manual.html#lua_Debug">lua_Debug</A><BR>
<A HREF="manual.html#lua_Hook">lua_Hook</A><BR>
<A HREF="manual.html#lua_Integer">lua_Integer</A><BR>
<A HREF="manual.html#lua_Number">lua_Number</A><BR>
<A HREF="manual.html#lua_Reader">lua_Reader</A><BR>
<A HREF="manual.html#lua_State">lua_State</A><BR>
<A HREF="manual.html#lua_Writer">lua_Writer</A><BR>
<P>

<A HREF="manual.html#lua_atpanic">lua_atpanic</A><BR>
<A HREF="manual.html#lua_call">lua_call</A><BR>
<A HREF="manual.html#lua_checkstack">lua_checkstack</A><BR>
<A HREF="manual.html#lua_close">lua_close</A><BR>
<A HREF="manual.html#lua_concat">lua_concat</A><BR>
<A HREF="manual.html#lua_cpcall">lua_cpcall</A><BR>
<A HREF="manual.html#lua_createtable">lua_createtable</A><BR>
<A HREF="manual.html#lua_dump">lua_dump</A><BR>
<A HREF="manual.html#lua_equal">lua_equal</A><BR>
<A HREF="manual.html#lua_error">lua_error</A><BR>
<A HREF="manual.html#lua_gc">lua_gc</A><BR>
<A HREF="manual.html#lua_getallocf">lua_getallocf</A><BR>
<A HREF="manual.html#lua_getfenv">lua_getfenv</A><BR>
<A HREF="manual.html#lua_getfield">lua_getfield</A><BR>
<A HREF="manual.html#lua_getglobal">lua_getglobal</A><BR>
<A HREF="manual.html#lua_gethook">lua_gethook</A><BR>
<A HREF="manual.html#lua_gethookcount">lua_gethookcount</A><BR>
<A HREF="manual.html#lua_gethookmask">lua_gethookmask</A><BR>
<A HREF="manual.html#lua_getinfo">lua_getinfo</A><BR>
<A HREF="manual.html#lua_getlocal">lua_getlocal</A><BR>
<A HREF="manual.html#lua_getmetatable">lua_getmetatable</A><BR>
<A HREF="manual.html#lua_getstack">lua_getstack</A><BR>
<A HREF="manual.html#lua_gettable">lua_gettable</A><BR>
<A HREF="manual.html#lua_gettop">lua_gettop</A><BR>
<A HREF="manual.html#lua_getupvalue">lua_getupvalue</A><BR>
<A HREF="manual.html#lua_insert">lua_insert</A><BR>
<A HREF="manual.html#lua_isboolean">lua_isboolean</A><BR>
<A HREF="manual.html#lua_iscfunction">lua_iscfunction</A><BR>
<A HREF="manual.html#lua_isfunction">lua_isfunction</A><BR>
<A HREF="manual.html#lua_islightuserdata">lua_islightuserdata</A><BR>
<A HREF="manual.html#lua_isnil">lua_isnil</A><BR>
<A HREF="manual.html#lua_isnone">lua_isnone</A><BR>
<A HREF="manual.html#lua_isnoneornil">lua_isnoneornil</A><BR>
<A HREF="manual.html#lua_isnumber">lua_isnumber</A><BR>
<A HREF="manual.html#lua_isstring">lua_isstring</A><BR>
<A HREF="manual.html#lua_istable">lua_istable</A><BR>
<A HREF="manual.html#lua_isthread">lua_isthread</A><BR>
<A HREF="manual.html#lua_isuserdata">lua_isuserdata</A><BR>
<A HREF="manual.html#lua_lessthan">lua_lessthan</A><BR>
<A HREF="manual.html#lua_load">lua_load</A><BR>
<A HREF="manual.html#lua_newstate">lua_newstate</A><BR>
<A HREF="manual.html#lua_newtable">lua_newtable</A><BR>
<A HREF="manual.html#lua_newthread">lua_newthread</A><BR>
<A HREF="manual.html#lua_newuserdata">lua_newuserdata</A><BR>
<A HREF="manual.html#lua_next">lua_next</A><BR>
<A HREF="manual.html#lua_objlen">lua_objlen</A><BR>
<A HREF="manual.html#lua_pcall">lua_pcall</A><BR>
<A HREF="manual.html#lua_pop">lua_pop</A><BR>
<A HREF="manual.html#lua_pushboolean">lua_pushboolean</A><BR>
<A HREF="manual.html#lua_pushcclosure">lua_pushcclosure</A><BR>
<A HREF="manual.html#lua_pushcfunction">lua_pushcfunction</A><BR>
<A HREF="manual.html#lua_pushfstring">lua_pushfstring</A><BR>
<A HREF="manual.html#lua_pushinteger">lua_pushinteger</A><BR>
<A HREF="manual.html#lua_pushlightuserdata">lua_pushlightuserdata</A><BR>
<A HREF="manual.html#lua_pushliteral">lua_pushliteral</A><BR>
<A HREF="manual.html#lua_pushlstring">lua_pushlstring</A><BR>
<A HREF="manual.html#lua_pushnil">lua_pushnil</A><BR>
<A HREF="manual.html#lua_pushnumber">lua_pushnumber</A><BR>
<A HREF="manual.html#lua_pushstring">lua_pushstring</A><BR>
<A HREF="manual.html#lua_pushthread">lua_pushthread</A><BR>
<A HREF="manual.html#lua_pushvalue">lua_pushvalue</A><BR>
<A HREF="manual.html#lua_pushvfstring">lua_pushvfstring</A><BR>
<A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR>
<A HREF="manual.html#lua_rawget">lua_rawget</A><BR>
<A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR>
<A HREF="manual.html#lua_rawset">lua_rawset</A><BR>
<A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR>
<A HREF="manual.html#lua_register">lua_register</A><BR>
<A HREF="manual.html#lua_remove">lua_remove</A><BR>
<A HREF="manual.html#lua_replace">lua_replace</A><BR>
<A HREF="manual.html#lua_resume">lua_resume</A><BR>
<A HREF="manual.html#lua_setallocf">lua_setallocf</A><BR>
<A HREF="manual.html#lua_setfenv">lua_setfenv</A><BR>
<A HREF="manual.html#lua_setfield">lua_setfield</A><BR>
<A HREF="manual.html#lua_setglobal">lua_setglobal</A><BR>
<A HREF="manual.html#lua_sethook">lua_sethook</A><BR>
<A HREF="manual.html#lua_setlocal">lua_setlocal</A><BR>
<A HREF="manual.html#lua_setmetatable">lua_setmetatable</A><BR>
<A HREF="manual.html#lua_settable">lua_settable</A><BR>
<A HREF="manual.html#lua_settop">lua_settop</A><BR>
<A HREF="manual.html#lua_setupvalue">lua_setupvalue</A><BR>
<A HREF="manual.html#lua_status">lua_status</A><BR>
<A HREF="manual.html#lua_toboolean">lua_toboolean</A><BR>
<A HREF="manual.html#lua_tocfunction">lua_tocfunction</A><BR>
<A HREF="manual.html#lua_tointeger">lua_tointeger</A><BR>
<A HREF="manual.html#lua_tolstring">lua_tolstring</A><BR>
<A HREF="manual.html#lua_tonumber">lua_tonumber</A><BR>
<A HREF="manual.html#lua_topointer">lua_topointer</A><BR>
<A HREF="manual.html#lua_tostring">lua_tostring</A><BR>
<A HREF="manual.html#lua_tothread">lua_tothread</A><BR>
<A HREF="manual.html#lua_touserdata">lua_touserdata</A><BR>
<A HREF="manual.html#lua_type">lua_type</A><BR>
<A HREF="manual.html#lua_typename">lua_typename</A><BR>
<A HREF="manual.html#lua_upvalueindex">lua_upvalueindex</A><BR>
<A HREF="manual.html#lua_xmove">lua_xmove</A><BR>
<A HREF="manual.html#lua_yield">lua_yield</A><BR>

</TD>
<TD>
<H3>auxiliary library</H3>
<A HREF="manual.html#luaL_Buffer">luaL_Buffer</A><BR>
<A HREF="manual.html#luaL_Reg">luaL_Reg</A><BR>
<P>

<A HREF="manual.html#luaL_addchar">luaL_addchar</A><BR>
<A HREF="manual.html#luaL_addlstring">luaL_addlstring</A><BR>
<A HREF="manual.html#luaL_addsize">luaL_addsize</A><BR>
<A HREF="manual.html#luaL_addstring">luaL_addstring</A><BR>
<A HREF="manual.html#luaL_addvalue">luaL_addvalue</A><BR>
<A HREF="manual.html#luaL_argcheck">luaL_argcheck</A><BR>
<A HREF="manual.html#luaL_argerror">luaL_argerror</A><BR>
<A HREF="manual.html#luaL_buffinit">luaL_buffinit</A><BR>
<A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR>
<A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR>
<A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR>
<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
<A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR>
<A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR>
<A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR>
<A HREF="manual.html#luaL_checkoption">luaL_checkoption</A><BR>
<A HREF="manual.html#luaL_checkstack">luaL_checkstack</A><BR>
<A HREF="manual.html#luaL_checkstring">luaL_checkstring</A><BR>
<A HREF="manual.html#luaL_checktype">luaL_checktype</A><BR>
<A HREF="manual.html#luaL_checkudata">luaL_checkudata</A><BR>
<A HREF="manual.html#luaL_dofile">luaL_dofile</A><BR>
<A HREF="manual.html#luaL_dostring">luaL_dostring</A><BR>
<A HREF="manual.html#luaL_error">luaL_error</A><BR>
<A HREF="manual.html#luaL_getmetafield">luaL_getmetafield</A><BR>
<A HREF="manual.html#luaL_getmetatable">luaL_getmetatable</A><BR>
<A HREF="manual.html#luaL_gsub">luaL_gsub</A><BR>
<A HREF="manual.html#luaL_loadbuffer">luaL_loadbuffer</A><BR>
<A HREF="manual.html#luaL_loadfile">luaL_loadfile</A><BR>
<A HREF="manual.html#luaL_loadstring">luaL_loadstring</A><BR>
<A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR>
<A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR>
<A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR>
<A HREF="manual.html#luaL_optint">luaL_optint</A><BR>
<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
<A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR>
<A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR>
<A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR>
<A HREF="manual.html#luaL_optstring">luaL_optstring</A><BR>
<A HREF="manual.html#luaL_prepbuffer">luaL_prepbuffer</A><BR>
<A HREF="manual.html#luaL_pushresult">luaL_pushresult</A><BR>
<A HREF="manual.html#luaL_ref">luaL_ref</A><BR>
<A HREF="manual.html#luaL_register">luaL_register</A><BR>
<A HREF="manual.html#luaL_typename">luaL_typename</A><BR>
<A HREF="manual.html#luaL_typerror">luaL_typerror</A><BR>
<A HREF="manual.html#luaL_unref">luaL_unref</A><BR>
<A HREF="manual.html#luaL_where">luaL_where</A><BR>

</TD>
</TR>
</TABLE>
<P>

<HR>
<SMALL>
Last update:
Sat Jan 19 13:24:29 BRST 2008
</SMALL>
<!--
Last change: revised for Lua 5.1.3
-->

</BODY>
</HTML>


================================================
FILE: doc/lua.1
================================================
.\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $
.TH LUA 1 "$Date: 2006/01/06 16:03:34 $"
.SH NAME
lua \- Lua interpreter
.SH SYNOPSIS
.B lua
[
.I options
]
[
.I script
[
.I args
]
]
.SH DESCRIPTION
.B lua
is the stand-alone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form.
(Precompiled binaries are output by
.BR luac ,
the Lua compiler.)
.B lua
can be used as a batch interpreter and also interactively.
.LP
The given
.I options
(see below)
are executed and then
the Lua program in file
.I script
is loaded and executed.
The given
.I args
are available to
.I script
as strings in a global table named
.BR arg .
If these arguments contain spaces or other characters special to the shell,
then they should be quoted
(but note that the quotes will be removed by the shell).
The arguments in
.B arg
start at 0,
which contains the string
.RI ' script '.
The index of the last argument is stored in
.BR arg.n .
The arguments given in the command line before
.IR script ,
including the name of the interpreter,
are available in negative indices in
.BR arg .
.LP
At the very start,
before even handling the command line,
.B lua
executes the contents of the environment variable
.BR LUA_INIT ,
if it is defined.
If the value of
.B LUA_INIT
is of the form
.RI '@ filename ',
then
.I filename
is executed.
Otherwise, the string is assumed to be a Lua statement and is executed.
.LP
Options start with
.B '\-'
and are described below.
You can use
.B "'\--'"
to signal the end of options.
.LP
If no arguments are given,
then
.B "\-v \-i"
is assumed when the standard input is a terminal;
otherwise,
.B "\-"
is assumed.
.LP
In interactive mode,
.B lua
prompts the user,
reads lines from the standard input,
and executes them as they are read.
If a line does not contain a complete statement,
then a secondary prompt is displayed and
lines are read until a complete statement is formed or
a syntax error is found.
So, one way to interrupt the reading of an incomplete statement is
to force a syntax error:
adding a
.B ';' 
in the middle of a statement is a sure way of forcing a syntax error
(except inside multiline strings and comments; these must be closed explicitly).
If a line starts with
.BR '=' ,
then
.B lua
displays the values of all the expressions in the remainder of the
line. The expressions must be separated by commas.
The primary prompt is the value of the global variable
.BR _PROMPT ,
if this value is a string;
otherwise, the default prompt is used.
Similarly, the secondary prompt is the value of the global variable
.BR _PROMPT2 .
So,
to change the prompts,
set the corresponding variable to a string of your choice.
You can do that after calling the interpreter
or on the command line
(but in this case you have to be careful with quotes
if the prompt string contains a space; otherwise you may confuse the shell.)
The default prompts are "> " and ">> ".
.SH OPTIONS
.TP
.B \-
load and execute the standard input as a file,
that is,
not interactively,
even when the standard input is a terminal.
.TP
.BI \-e " stat"
execute statement
.IR stat .
You need to quote
.I stat 
if it contains spaces, quotes,
or other characters special to the shell.
.TP
.B \-i
enter interactive mode after
.I script
is executed.
.TP
.BI \-l " name"
call
.BI require(' name ')
before executing
.IR script .
Typically used to load libraries.
.TP
.B \-v
show version information.
.SH "SEE ALSO"
.BR luac (1)
.br
http://www.lua.org/
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
R. Ierusalimschy,
L. H. de Figueiredo,
and
W. Celes
.\" EOF


================================================
FILE: doc/lua.css
================================================
body {
	color: #000000 ;
	background-color: #FFFFFF ;
	font-family: sans-serif ;
	text-align: justify ;
	margin-right: 20px ;
	margin-left: 20px ;
}

h1, h2, h3, h4 {
	font-weight: normal ;
	font-style: italic ;
}

a:link {
	color: #000080 ;
	background-color: inherit ;
	text-decoration: none ;
}

a:visited {
	background-color: inherit ;
	text-decoration: none ;
}

a:link:hover, a:visited:hover {
	color: #000080 ;
	background-color: #E0E0FF ;
}

a:link:active, a:visited:active {
	color: #FF0000 ;
}

hr {
	border: 0 ;
	height: 1px ;
	color: #a0a0a0 ;
	background-color: #a0a0a0 ;
}



================================================
FILE: doc/lua.html
================================================
<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->
<HTML>
<HEAD>
<TITLE>LUA man page</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
</HEAD>

<BODY BGCOLOR="#FFFFFF">

<H2>NAME</H2>
lua - Lua interpreter
<H2>SYNOPSIS</H2>
<B>lua</B>
[
<I>options</I>
]
[
<I>script</I>
[
<I>args</I>
]
]
<H2>DESCRIPTION</H2>
<B>lua</B>
is the stand-alone Lua interpreter.
It loads and executes Lua programs,
either in textual source form or
in precompiled binary form.
(Precompiled binaries are output by
<B>luac</B>,
the Lua compiler.)
<B>lua</B>
can be used as a batch interpreter and also interactively.
<P>
The given
<I>options</I>
(see below)
are executed and then
the Lua program in file
<I>script</I>
is loaded and executed.
The given
<I>args</I>
are available to
<I>script</I>
as strings in a global table named
<B>arg</B>.
If these arguments contain spaces or other characters special to the shell,
then they should be quoted
(but note that the quotes will be removed by the shell).
The arguments in
<B>arg</B>
start at 0,
which contains the string
'<I>script</I>'.
The index of the last argument is stored in
<B>arg.n</B>.
The arguments given in the command line before
<I>script</I>,
including the name of the interpreter,
are available in negative indices in
<B>arg</B>.
<P>
At the very start,
before even handling the command line,
<B>lua</B>
executes the contents of the environment variable
<B>LUA_INIT</B>,
if it is defined.
If the value of
<B>LUA_INIT</B>
is of the form
'@<I>filename</I>',
then
<I>filename</I>
is executed.
Otherwise, the string is assumed to be a Lua statement and is executed.
<P>
Options start with
<B>'-'</B>
and are described below.
You can use
<B>'--'</B>
to signal the end of options.
<P>
If no arguments are given,
then
<B>"-v -i"</B>
is assumed when the standard input is a terminal;
otherwise,
<B>"-"</B>
is assumed.
<P>
In interactive mode,
<B>lua</B>
prompts the user,
reads lines from the standard input,
and executes them as they are read.
If a line does not contain a complete statement,
then a secondary prompt is displayed and
lines are read until a complete statement is formed or
a syntax error is found.
So, one way to interrupt the reading of an incomplete statement is
to force a syntax error:
adding a
<B>';'</B>
in the middle of a statement is a sure way of forcing a syntax error
(except inside multiline strings and comments; these must be closed explicitly).
If a line starts with
<B>'='</B>,
then
<B>lua</B>
displays the values of all the expressions in the remainder of the
line. The expressions must be separated by commas.
The primary prompt is the value of the global variable
<B>_PROMPT</B>,
if this value is a string;
otherwise, the default prompt is used.
Similarly, the secondary prompt is the value of the global variable
<B>_PROMPT2</B>.
So,
to change the prompts,
set the corresponding variable to a string of your choice.
You can do that after calling the interpreter
or on the command line
(but in this case you have to be careful with quotes
if the prompt string contains a space; otherwise you may confuse the shell.)
The default prompts are "&gt; " and "&gt;&gt; ".
<H2>OPTIONS</H2>
<P>
<B>-</B>
load and execute the standard input as a file,
that is,
not interactively,
even when the standard input is a terminal.
<P>
<B>-e </B><I>stat</I>
execute statement
<I>stat</I>.
You need to quote
<I>stat </I>
if it contains spaces, quotes,
or other characters special to the shell.
<P>
<B>-i</B>
enter interactive mode after
<I>script</I>
is executed.
<P>
<B>-l </B><I>name</I>
call
<B>require</B>('<I>name</I>')
before executing
<I>script</I>.
Typically used to load libraries.
<P>
<B>-v</B>
show version information.
<H2>SEE ALSO</H2>
<B>luac</B>(1)
<BR>
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
<H2>DIAGNOSTICS</H2>
Error messages should be self explanatory.
<H2>AUTHORS</H2>
R. Ierusalimschy,
L. H. de Figueiredo,
and
W. Celes
<!-- EOF -->
</BODY>
</HTML>


================================================
FILE: doc/luac.1
================================================
.\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $
.TH LUAC 1 "$Date: 2006/01/06 16:03:34 $"
.SH NAME
luac \- Lua compiler
.SH SYNOPSIS
.B luac
[
.I options
] [
.I filenames
]
.SH DESCRIPTION
.B luac
is the Lua compiler.
It translates programs written in the Lua programming language
into binary files that can be later loaded and executed.
.LP
The main advantages of precompiling chunks are:
faster loading,
protecting source code from accidental user changes,
and
off-line syntax checking.
.LP
Pre-compiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
.B luac
simply allows those bytecodes to be saved in a file for later execution.
.LP
Pre-compiled chunks are not necessarily smaller than the corresponding source.
The main goal in pre-compiling is faster loading.
.LP
The binary files created by
.B luac
are portable only among architectures with the same word size and byte order.
.LP
.B luac
produces a single output file containing the bytecodes
for all source files given.
By default,
the output file is named
.BR luac.out ,
but you can change this with the
.B \-o
option.
.LP
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
This is useful to combine several precompiled chunks,
even from different (but compatible) platforms,
into a single precompiled chunk.
.LP
You can use
.B "'\-'"
to indicate the standard input as a source file
and
.B "'\--'"
to signal the end of options
(that is,
all remaining arguments will be treated as files even if they start with
.BR "'\-'" ).
.LP
The internal format of the binary files produced by
.B luac
is likely to change when a new version of Lua is released.
So,
save the source files of all Lua programs that you precompile.
.LP
.SH OPTIONS
Options must be separate.
.TP
.B \-l
produce a listing of the compiled bytecode for Lua's virtual machine.
Listing bytecodes is useful to learn about Lua's virtual machine.
If no files are given, then
.B luac
loads
.B luac.out
and lists its contents.
.TP
.BI \-o " file"
output to
.IR file ,
instead of the default
.BR luac.out .
(You can use
.B "'\-'"
for standard output,
but not on platforms that open standard output in text mode.)
The output file may be a source file because
all files are loaded before the output file is written.
Be careful not to overwrite precious files.
.TP
.B \-p
load files but do not generate any output file.
Used mainly for syntax checking and for testing precompiled chunks:
corrupted files will probably generate errors when loaded.
Lua always performs a thorough integrity test on precompiled chunks.
Bytecode that passes this test is completely safe,
in the sense that it will not break the interpreter.
However,
there is no guarantee that such code does anything sensible.
(None can be given, because the halting problem is unsolvable.)
If no files are given, then
.B luac
loads
.B luac.out
and tests its contents.
No messages are displayed if the file passes the integrity test.
.TP
.B \-s
strip debug information before writing the output file.
This saves some space in very large chunks,
but if errors occur when running a stripped chunk,
then the error messages may not contain the full information they usually do.
For instance,
line numbers and names of local variables are lost.
.TP
.B \-v
show version information.
.SH FILES
.TP 15
.B luac.out
default output file
.SH "SEE ALSO"
.BR lua (1)
.br
http://www.lua.org/
.SH DIAGNOSTICS
Error messages should be self explanatory.
.SH AUTHORS
L. H. de Figueiredo,
R. Ierusalimschy and
W. Celes
.\" EOF


================================================
FILE: doc/luac.html
================================================
<!-- $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -->
<HTML>
<HEAD>
<TITLE>LUAC man page</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="lua.css">
</HEAD>

<BODY BGCOLOR="#FFFFFF">

<H2>NAME</H2>
luac - Lua compiler
<H2>SYNOPSIS</H2>
<B>luac</B>
[
<I>options</I>
] [
<I>filenames</I>
]
<H2>DESCRIPTION</H2>
<B>luac</B>
is the Lua compiler.
It translates programs written in the Lua programming language
into binary files that can be later loaded and executed.
<P>
The main advantages of precompiling chunks are:
faster loading,
protecting source code from accidental user changes,
and
off-line syntax checking.
<P>
Precompiling does not imply faster execution
because in Lua chunks are always compiled into bytecodes before being executed.
<B>luac</B>
simply allows those bytecodes to be saved in a file for later execution.
<P>
Precompiled chunks are not necessarily smaller than the corresponding source.
The main goal in precompiling is faster loading.
<P>
The binary files created by
<B>luac</B>
are portable only among architectures with the same word size and byte order.
<P>
<B>luac</B>
produces a single output file containing the bytecodes
for all source files given.
By default,
the output file is named
<B>luac.out</B>,
but you can change this with the
<B>-o</B>
option.
<P>
In the command line,
you can mix
text files containing Lua source and
binary files containing precompiled chunks.
This is useful because several precompiled chunks,
even from different (but compatible) platforms,
can be combined into a single precompiled chunk.
<P>
You can use
<B>'-'</B>
to indicate the standard input as a source file
and
<B>'--'</B>
to signal the end of options
(that is,
all remaining arguments will be treated as files even if they start with
<B>'-'</B>).
<P>
The internal format of the binary files produced by
<B>luac</B>
is likely to change when a new version of Lua is released.
So,
save the source files of all Lua programs that you precompile.
<P>
<H2>OPTIONS</H2>
Options must be separate.
<P>
<B>-l</B>
produce a listing of the compiled bytecode for Lua's virtual machine.
Listing bytecodes is useful to learn about Lua's virtual machine.
If no files are given, then
<B>luac</B>
loads
<B>luac.out</B>
and lists its contents.
<P>
<B>-o </B><I>file</I>
output to
<I>file</I>,
instead of the default
<B>luac.out</B>.
(You can use
<B>'-'</B>
for standard output,
but not on platforms that open standard output in text mode.)
The output file may be a source file because
all files are loaded before the output file is written.
Be careful not to overwrite precious files.
<P>
<B>-p</B>
load files but do not generate any output file.
Used mainly for syntax checking and for testing precompiled chunks:
corrupted files will probably generate errors when loaded.
Lua always performs a thorough integrity test on precompiled chunks.
Bytecode that passes this test is completely safe,
in the sense that it will not break the interpreter.
However,
there is no guarantee that such code does anything sensible.
(None can be given, because the halting problem is unsolvable.)
If no files are given, then
<B>luac</B>
loads
<B>luac.out</B>
and tests its contents.
No messages are displayed if the file passes the integrity test.
<P>
<B>-s</B>
strip debug information before writing the output file.
This saves some space in very large chunks,
but if errors occur when running a stripped chunk,
then the error messages may not contain the full information they usually do.
For instance,
line numbers and names of local variables are lost.
<P>
<B>-v</B>
show version information.
<H2>FILES</H2>
<P>
<B>luac.out</B>
default output file
<H2>SEE ALSO</H2>
<B>lua</B>(1)
<BR>
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
<H2>DIAGNOSTICS</H2>
Error messages should be self explanatory.
<H2>AUTHORS</H2>
L. H. de Figueiredo,
R. Ierusalimschy and
W. Celes
<!-- EOF -->
</BODY>
</HTML>


================================================
FILE: doc/manual.css
================================================
h3 code {
	font-family: inherit ;
}

pre {
	font-size: 105% ;
}

span.apii {
	float: right ;
	font-family: inherit ;
}



================================================
FILE: doc/manual.html
================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<title>Lua 5.1 Reference Manual</title>
<link rel="stylesheet" type="text/css" href="lua.css">
<link rel="stylesheet" type="text/css" href="manual.css">
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
</head>

<body>

<hr>
<h1>
<a href="http://www.lua.org/"><img src="logo.gif" alt="" border="0"></a>
Lua 5.1 Reference Manual
</h1>

by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes
<p>
<small>
Copyright &copy; 2006-2008 Lua.org, PUC-Rio.
Freely available under the terms of the
<a href="http://www.lua.org/license.html#5">Lua license</a>.
</small>
<hr>
<p>

<a href="contents.html#contents">contents</A>
&middot;
<a href="contents.html#index">index</A>

<!-- ====================================================================== -->
<p>

<!-- $Id: manual.of,v 1.48 2008/08/18 15:24:20 roberto Exp $ -->




<h1>1 - <a name="1">Introduction</a></h1>

<p>
Lua is an extension programming language designed to support
general procedural programming with data description
facilities.
It also offers good support for object-oriented programming,
functional programming, and data-driven programming.
Lua is intended to be used as a powerful, light-weight
scripting language for any program that needs one.
Lua is implemented as a library, written in <em>clean</em> C
(that is, in the common subset of ANSI&nbsp;C and C++).


<p>
Being an extension language, Lua has no notion of a "main" program:
it only works <em>embedded</em> in a host client,
called the <em>embedding program</em> or simply the <em>host</em>.
This host program can invoke functions to execute a piece of Lua code,
can write and read Lua variables,
and can register C&nbsp;functions to be called by Lua code.
Through the use of C&nbsp;functions, Lua can be augmented to cope with
a wide range of different domains,
thus creating customized programming languages sharing a syntactical framework.
The Lua distribution includes a sample host program called <code>lua</code>,
which uses the Lua library to offer a complete, stand-alone Lua interpreter.


<p>
Lua is free software,
and is provided as usual with no guarantees,
as stated in its license.
The implementation described in this manual is available
at Lua's official web site, <code>www.lua.org</code>.


<p>
Like any other reference manual,
this document is dry in places.
For a discussion of the decisions behind the design of Lua,
see the technical papers available at Lua's web site.
For a detailed introduction to programming in Lua,
see Roberto's book, <em>Programming in Lua (Second Edition)</em>.



<h1>2 - <a name="2">The Language</a></h1>

<p>
This section describes the lexis, the syntax, and the semantics of Lua.
In other words,
this section describes
which tokens are valid,
how they can be combined,
and what their combinations mean.


<p>
The language constructs will be explained using the usual extended BNF notation,
in which
{<em>a</em>}&nbsp;means&nbsp;0 or more <em>a</em>'s, and
[<em>a</em>]&nbsp;means an optional <em>a</em>.
Non-terminals are shown like non-terminal,
keywords are shown like <b>kword</b>,
and other terminal symbols are shown like `<b>=</b>&acute;.
The complete syntax of Lua can be found in <a href="#8">&sect;8</a>
at the end of this manual.



<h2>2.1 - <a name="2.1">Lexical Conventions</a></h2>

<p>
<em>Names</em>
(also called <em>identifiers</em>)
in Lua can be any string of letters,
digits, and underscores,
not beginning with a digit.
This coincides with the definition of names in most languages.
(The definition of letter depends on the current locale:
any character considered alphabetic by the current locale
can be used in an identifier.)
Identifiers are used to name variables and table fields.


<p>
The following <em>keywords</em> are reserved
and cannot be used as names:


<pre>
     and       break     do        else      elseif
     end       false     for       function  if
     in        local     nil       not       or
     repeat    return    then      true      until     while
</pre>

<p>
Lua is a case-sensitive language:
<code>and</code> is a reserved word, but <code>And</code> and <code>AND</code>
are two different, valid names.
As a convention, names starting with an underscore followed by
uppercase letters (such as <a href="#pdf-_VERSION"><code>_VERSION</code></a>)
are reserved for internal global variables used by Lua.


<p>
The following strings denote other tokens:

<pre>
     +     -     *     /     %     ^     #
     ==    ~=    &lt;=    &gt;=    &lt;     &gt;     =
     (     )     {     }     [     ]
     ;     :     ,     .     ..    ...
</pre>

<p>
<em>Literal strings</em>
can be delimited by matching single or double quotes,
and can contain the following C-like escape sequences:
'<code>\a</code>' (bell),
'<code>\b</code>' (backspace),
'<code>\f</code>' (form feed),
'<code>\n</code>' (newline),
'<code>\r</code>' (carriage return),
'<code>\t</code>' (horizontal tab),
'<code>\v</code>' (vertical tab),
'<code>\\</code>' (backslash),
'<code>\"</code>' (quotation mark [double quote]),
and '<code>\'</code>' (apostrophe [single quote]).
Moreover, a backslash followed by a real newline
results in a newline in the string.
A character in a string can also be specified by its numerical value
using the escape sequence <code>\<em>ddd</em></code>,
where <em>ddd</em> is a sequence of up to three decimal digits.
(Note that if a numerical escape is to be followed by a digit,
it must be expressed using exactly three digits.)
Strings in Lua can contain any 8-bit value, including embedded zeros,
which can be specified as '<code>\0</code>'.


<p>
Literal strings can also be defined using a long format
enclosed by <em>long brackets</em>.
We define an <em>opening long bracket of level <em>n</em></em> as an opening
square bracket followed by <em>n</em> equal signs followed by another
opening square bracket.
So, an opening long bracket of level&nbsp;0 is written as <code>[[</code>,
an opening long bracket of level&nbsp;1 is written as <code>[=[</code>,
and so on.
A <em>closing long bracket</em> is defined similarly;
for instance, a closing long bracket of level&nbsp;4 is written as <code>]====]</code>.
A long string starts with an opening long bracket of any level and
ends at the first closing long bracket of the same level.
Literals in this bracketed form can run for several lines,
do not interpret any escape sequences,
and ignore long brackets of any other level.
They can contain anything except a closing bracket of the proper level.


<p>
For convenience,
when the opening long bracket is immediately followed by a newline,
the newline is not included in the string.
As an example, in a system using ASCII
(in which '<code>a</code>' is coded as&nbsp;97,
newline is coded as&nbsp;10, and '<code>1</code>' is coded as&nbsp;49),
the five literal strings below denote the same string:

<pre>
     a = 'alo\n123"'
     a = "alo\n123\""
     a = '\97lo\10\04923"'
     a = [[alo
     123"]]
     a = [==[
     alo
     123"]==]
</pre>

<p>
A <em>numerical constant</em> can be written with an optional decimal part
and an optional decimal exponent.
Lua also accepts integer hexadecimal constants,
by prefixing them with <code>0x</code>.
Examples of valid numerical constants are

<pre>
     3   3.0   3.1416   314.16e-2   0.31416E1   0xff   0x56
</pre>

<p>
A <em>comment</em> starts with a double hyphen (<code>--</code>)
anywhere outside a string.
If the text immediately after <code>--</code> is not an opening long bracket,
the comment is a <em>short comment</em>,
which runs until the end of the line.
Otherwise, it is a <em>long comment</em>,
which runs until the corresponding closing long bracket.
Long comments are frequently used to disable code temporarily.





<h2>2.2 - <a name="2.2">Values and Types</a></h2>

<p>
Lua is a <em>dynamically typed language</em>.
This means that
variables do not have types; only values do.
There are no type definitions in the language.
All values carry their own type.


<p>
All values in Lua are <em>first-class values</em>.
This means that all values can be stored in variables,
passed as arguments to other functions, and returned as results.


<p>
There are eight basic types in Lua:
<em>nil</em>, <em>boolean</em>, <em>number</em>,
<em>string</em>, <em>function</em>, <em>userdata</em>,
<em>thread</em>, and <em>table</em>.
<em>Nil</em> is the type of the value <b>nil</b>,
whose main property is to be different from any other value;
it usually represents the absence of a useful value.
<em>Boolean</em> is the type of the values <b>false</b> and <b>true</b>.
Both <b>nil</b> and <b>false</b> make a condition false;
any other value makes it true.
<em>Number</em> represents real (double-precision floating-point) numbers.
(It is easy to build Lua interpreters that use other
internal representations for numbers,
such as single-precision float or long integers;
see file <code>luaconf.h</code>.)
<em>String</em> represents arrays of characters.

Lua is 8-bit clean:
strings can contain any 8-bit character,
including embedded zeros ('<code>\0</code>') (see <a href="#2.1">&sect;2.1</a>).


<p>
Lua can call (and manipulate) functions written in Lua and
functions written in C
(see <a href="#2.5.8">&sect;2.5.8</a>).


<p>
The type <em>userdata</em> is provided to allow arbitrary C&nbsp;data to
be stored in Lua variables.
This type corresponds to a block of raw memory
and has no pre-defined operations in Lua,
except assignment and identity test.
However, by using <em>metatables</em>,
the programmer can define operations for userdata values
(see <a href="#2.8">&sect;2.8</a>).
Userdata values cannot be created or modified in Lua,
only through the C&nbsp;API.
This guarantees the integrity of data owned by the host program.


<p>
The type <em>thread</em> represents independent threads of execution
and it is used to implement coroutines (see <a href="#2.11">&sect;2.11</a>).
Do not confuse Lua threads with operating-system threads.
Lua supports coroutines on all systems,
even those that do not support threads.


<p>
The type <em>table</em> implements associative arrays,
that is, arrays that can be indexed not only with numbers,
but with any value (except <b>nil</b>).
Tables can be <em>heterogeneous</em>;
that is, they can contain values of all types (except <b>nil</b>).
Tables are the sole data structuring mechanism in Lua;
they can be used to represent ordinary arrays,
symbol tables, sets, records, graphs, trees, etc.
To represent records, Lua uses the field name as an index.
The language supports this representation by
providing <code>a.name</code> as syntactic sugar for <code>a["name"]</code>.
There are several convenient ways to create tables in Lua
(see <a href="#2.5.7">&sect;2.5.7</a>).


<p>
Like indices,
the value of a table field can be of any type (except <b>nil</b>).
In particular,
because functions are first-class values,
table fields can contain functions.
Thus tables can also carry <em>methods</em> (see <a href="#2.5.9">&sect;2.5.9</a>).


<p>
Tables, functions, threads, and (full) userdata values are <em>objects</em>:
variables do not actually <em>contain</em> these values,
only <em>references</em> to them.
Assignment, parameter passing, and function returns
always manipulate references to such values;
these operations do not imply any kind of copy.


<p>
The library function <a href="#pdf-type"><code>type</code></a> returns a string describing the type
of a given value.



<h3>2.2.1 - <a name="2.2.1">Coercion</a></h3>

<p>
Lua provides automatic conversion between
string and number values at run time.
Any arithmetic operation applied to a string tries to convert
this string to a number, following the usual conversion rules.
Conversely, whenever a number is used where a string is expected,
the number is converted to a string, in a reasonable format.
For complete control over how numbers are converted to strings,
use the <code>format</code> function from the string library
(see <a href="#pdf-string.format"><code>string.format</code></a>).







<h2>2.3 - <a name="2.3">Variables</a></h2>

<p>
Variables are places that store values.

There are three kinds of variables in Lua:
global variables, local variables, and table fields.


<p>
A single name can denote a global variable or a local variable
(or a function's formal parameter,
which is a particular kind of local variable):

<pre>
	var ::= Name
</pre><p>
Name denotes identifiers, as defined in <a href="#2.1">&sect;2.1</a>.


<p>
Any variable is assumed to be global unless explicitly declared
as a local (see <a href="#2.4.7">&sect;2.4.7</a>).
Local variables are <em>lexically scoped</em>:
local variables can be freely accessed by functions
defined inside their scope (see <a href="#2.6">&sect;2.6</a>).


<p>
Before the first assignment to a variable, its value is <b>nil</b>.


<p>
Square brackets are used to index a table:

<pre>
	var ::= prefixexp `<b>[</b>&acute; exp `<b>]</b>&acute;
</pre><p>
The meaning of accesses to global variables 
and table fields can be changed via metatables.
An access to an indexed variable <code>t[i]</code> is equivalent to
a call <code>gettable_event(t,i)</code>.
(See <a href="#2.8">&sect;2.8</a> for a complete description of the
<code>gettable_event</code> function.
This function is not defined or callable in Lua.
We use it here only for explanatory purposes.)


<p>
The syntax <code>var.Name</code> is just syntactic sugar for
<code>var["Name"]</code>:

<pre>
	var ::= prefixexp `<b>.</b>&acute; Name
</pre>

<p>
All global variables live as fields in ordinary Lua tables,
called <em>environment tables</em> or simply
<em>environments</em> (see <a href="#2.9">&sect;2.9</a>).
Each function has its own reference to an environment,
so that all global variables in this function
will refer to this environment table.
When a function is created,
it inherits the environment from the function that created it.
To get the environment table of a Lua function,
you call <a href="#pdf-getfenv"><code>getfenv</code></a>.
To replace it,
you call <a href="#pdf-setfenv"><code>setfenv</code></a>.
(You can only manipulate the environment of C&nbsp;functions
through the debug library; (see <a href="#5.9">&sect;5.9</a>).)


<p>
An access to a global variable <code>x</code>
is equivalent to <code>_env.x</code>,
which in turn is equivalent to

<pre>
     gettable_event(_env, "x")
</pre><p>
where <code>_env</code> is the environment of the running function.
(See <a href="#2.8">&sect;2.8</a> for a complete description of the
<code>gettable_event</code> function.
This function is not defined or callable in Lua.
Similarly, the <code>_env</code> variable is not defined in Lua.
We use them here only for explanatory purposes.)





<h2>2.4 - <a name="2.4">Statements</a></h2>

<p>
Lua supports an almost conventional set of statements,
similar to those in Pascal or C.
This set includes
assignments, control structures, function calls,
and variable declarations.



<h3>2.4.1 - <a name="2.4.1">Chunks</a></h3>

<p>
The unit of execution of Lua is called a <em>chunk</em>.
A chunk is simply a sequence of statements,
which are executed sequentially.
Each statement can be optionally followed by a semicolon:

<pre>
	chunk ::= {stat [`<b>;</b>&acute;]}
</pre><p>
There are no empty statements and thus '<code>;;</code>' is not legal.


<p>
Lua handles a chunk as the body of an anonymous function 
with a variable number of arguments
(see <a href="#2.5.9">&sect;2.5.9</a>).
As such, chunks can define local variables,
receive arguments, and return values.


<p>
A chunk can be stored in a file or in a string inside the host program.
To execute a chunk,
Lua first pre-compiles the chunk into instructions for a virtual machine,
and then it executes the compiled code
with an interpreter for the virtual machine.


<p>
Chunks can also be pre-compiled into binary form;
see program <code>luac</code> for details.
Programs in source and compiled forms are interchangeable;
Lua automatically detects the file type and acts accordingly.






<h3>2.4.2 - <a name="2.4.2">Blocks</a></h3><p>
A block is a list of statements;
syntactically, a block is the same as a chunk:

<pre>
	block ::= chunk
</pre>

<p>
A block can be explicitly delimited to produce a single statement:

<pre>
	stat ::= <b>do</b> block <b>end</b>
</pre><p>
Explicit blocks are useful
to control the scope of variable declarations.
Explicit blocks are also sometimes used to
add a <b>return</b> or <b>break</b> statement in the middle
of another block (see <a href="#2.4.4">&sect;2.4.4</a>).





<h3>2.4.3 - <a name="2.4.3">Assignment</a></h3>

<p>
Lua allows multiple assignments.
Therefore, the syntax for assignment
defines a list of variables on the left side
and a list of expressions on the right side.
The elements in both lists are separated by commas:

<pre>
	stat ::= varlist `<b>=</b>&acute; explist
	varlist ::= var {`<b>,</b>&acute; var}
	explist ::= exp {`<b>,</b>&acute; exp}
</pre><p>
Expressions are discussed in <a href="#2.5">&sect;2.5</a>.


<p>
Before the assignment,
the list of values is <em>adjusted</em> to the length of
the list of variables.
If there are more values than needed,
the excess values are thrown away.
If there are fewer values than needed,
the list is extended with as many  <b>nil</b>'s as needed.
If the list of expressions ends with a function call,
then all values returned by that call enter the list of values,
before the adjustment
(except when the call is enclosed in parentheses; see <a href="#2.5">&sect;2.5</a>).


<p>
The assignment statement first evaluates all its expressions
and only then are the assignments performed.
Thus the code

<pre>
     i = 3
     i, a[i] = i+1, 20
</pre><p>
sets <code>a[3]</code> to 20, without affecting <code>a[4]</code>
because the <code>i</code> in <code>a[i]</code> is evaluated (to 3)
before it is assigned&nbsp;4.
Similarly, the line

<pre>
     x, y = y, x
</pre><p>
exchanges the values of <code>x</code> and <code>y</code>,
and

<pre>
     x, y, z = y, z, x
</pre><p>
cyclically permutes the values of <code>x</code>, <code>y</code>, and <code>z</code>.


<p>
The meaning of assignments to global variables
and table fields can be changed via metatables.
An assignment to an indexed variable <code>t[i] = val</code> is equivalent to
<code>settable_event(t,i,val)</code>.
(See <a href="#2.8">&sect;2.8</a> for a complete description of the
<code>settable_event</code> function.
This function is not defined or callable in Lua.
We use it here only for explanatory purposes.)


<p>
An assignment to a global variable <code>x = val</code>
is equivalent to the assignment
<code>_env.x = val</code>,
which in turn is equivalent to

<pre>
     settable_event(_env, "x", val)
</pre><p>
where <code>_env</code> is the environment of the running function.
(The <code>_env</code> variable is not defined in Lua.
We use it here only for explanatory purposes.)





<h3>2.4.4 - <a name="2.4.4">Control Structures</a></h3><p>
The control structures
<b>if</b>, <b>while</b>, and <b>repeat</b> have the usual meaning and
familiar syntax:




<pre>
	stat ::= <b>while</b> exp <b>do</b> block <b>end</b>
	stat ::= <b>repeat</b> block <b>until</b> exp
	stat ::= <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b>
</pre><p>
Lua also has a <b>for</b> statement, in two flavors (see <a href="#2.4.5">&sect;2.4.5</a>).


<p>
The condition expression of a
control structure can return any value.
Both <b>false</b> and <b>nil</b> are considered false.
All values different from <b>nil</b> and <b>false</b> are considered true
(in particular, the number 0 and the empty string are also true).


<p>
In the <b>repeat</b>&ndash;<b>until</b> loop,
the inner block does not end at the <b>until</b> keyword,
but only after the condition.
So, the condition can refer to local variables
declared inside the loop block.


<p>
The <b>return</b> statement is used to return values
from a function or a chunk (which is just a function).

Functions and chunks can return more than one value,
and so the syntax for the <b>return</b> statement is

<pre>
	stat ::= <b>return</b> [explist]
</pre>

<p>
The <b>break</b> statement is used to terminate the execution of a
<b>while</b>, <b>repeat</b>, or <b>for</b> loop,
skipping to the next statement after the loop:


<pre>
	stat ::= <b>break</b>
</pre><p>
A <b>break</b> ends the innermost enclosing loop.


<p>
The <b>return</b> and <b>break</b>
statements can only be written as the <em>last</em> statement of a block.
If it is really necessary to <b>return</b> or <b>break</b> in the
middle of a block,
then an explicit inner block can be used,
as in the idioms
<code>do return end</code> and <code>do break end</code>,
because now <b>return</b> and <b>break</b> are the last statements in
their (inner) blocks.





<h3>2.4.5 - <a name="2.4.5">For Statement</a></h3>

<p>

The <b>for</b> statement has two forms:
one numeric and one generic.


<p>
The numeric <b>for</b> loop repeats a block of code while a
control variable runs through an arithmetic progression.
It has the following syntax:

<pre>
	stat ::= <b>for</b> Name `<b>=</b>&acute; exp `<b>,</b>&acute; exp [`<b>,</b>&acute; exp] <b>do</b> block <b>end</b>
</pre><p>
The <em>block</em> is repeated for <em>name</em> starting at the value of
the first <em>exp</em>, until it passes the second <em>exp</em> by steps of the
third <em>exp</em>.
More precisely, a <b>for</b> statement like

<pre>
     for v = <em>e1</em>, <em>e2</em>, <em>e3</em> do <em>block</em> end
</pre><p>
is equivalent to the code:

<pre>
     do
       local <em>var</em>, <em>limit</em>, <em>step</em> = tonumber(<em>e1</em>), tonumber(<em>e2</em>), tonumber(<em>e3</em>)
       if not (<em>var</em> and <em>limit</em> and <em>step</em>) then error() end
       while (<em>step</em> &gt; 0 and <em>var</em> &lt;= <em>limit</em>) or (<em>step</em> &lt;= 0 and <em>var</em> &gt;= <em>limit</em>) do
         local v = <em>var</em>
         <em>block</em>
         <em>var</em> = <em>var</em> + <em>step</em>
       end
     end
</pre><p>
Note the following:

<ul>

<li>
All three control expressions are evaluated only once,
before the loop starts.
They must all result in numbers.
</li>

<li>
<code><em>var</em></code>, <code><em>limit</em></code>, and <code><em>step</em></code> are invisible variables.
The names shown here are for explanatory purposes only.
</li>

<li>
If the third expression (the step) is absent,
then a step of&nbsp;1 is used.
</li>

<li>
You can use <b>break</b> to exit a <b>for</b> loop.
</li>

<li>
The loop variable <code>v</code> is local to the loop;
you cannot use its value after the <b>for</b> ends or is broken.
If you need this value,
assign it to another variable before breaking or exiting the loop.
</li>

</ul>

<p>
The generic <b>for</b> statement works over functions,
called <em>iterators</em>.
On each iteration, the iterator function is called to produce a new value,
stopping when this new value is <b>nil</b>.
The generic <b>for</b> loop has the following syntax:

<pre>
	stat ::= <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b>
	namelist ::= Name {`<b>,</b>&acute; Name}
</pre><p>
A <b>for</b> statement like

<pre>
     for <em>var_1</em>, &middot;&middot;&middot;, <em>var_n</em> in <em>explist</em> do <em>block</em> end
</pre><p>
is equivalent to the code:

<pre>
     do
       local <em>f</em>, <em>s</em>, <em>var</em> = <em>explist</em>
       while true do
         local <em>var_1</em>, &middot;&middot;&middot;, <em>var_n</em> = <em>f</em>(<em>s</em>, <em>var</em>)
         <em>var</em> = <em>var_1</em>
         if <em>var</em> == nil then break end
         <em>block</em>
       end
     end
</pre><p>
Note the following:

<ul>

<li>
<code><em>explist</em></code> is evaluated only once.
Its results are an <em>iterator</em> function,
a <em>state</em>,
and an initial value for the first <em>iterator variable</em>.
</li>

<li>
<code><em>f</em></code>, <code><em>s</em></code>, and <code><em>var</em></code> are invisible variables.
The names are here for explanatory purposes only.
</li>

<li>
You can use <b>break</b> to exit a <b>for</b> loop.
</li>

<li>
The loop variables <code><em>var_i</em></code> are local to the loop;
you cannot use their values after the <b>for</b> ends.
If you need these values,
then assign them to other variables before breaking or exiting the loop.
</li>

</ul>




<h3>2.4.6 - <a name="2.4.6">Function Calls as Statements</a></h3><p>
To allow possible side-effects,
function calls can be executed as statements:

<pre>
	stat ::= functioncall
</pre><p>
In this case, all returned values are thrown away.
Function calls are explained in <a href="#2.5.8">&sect;2.5.8</a>.





<h3>2.4.7 - <a name="2.4.7">Local Declarations</a></h3><p>
Local variables can be declared anywhere inside a block.
The declaration can include an initial assignment:

<pre>
	stat ::= <b>local</b> namelist [`<b>=</b>&acute; explist]
</pre><p>
If present, an initial assignment has the same semantics
of a multiple assignment (see <a href="#2.4.3">&sect;2.4.3</a>).
Otherwise, all variables are initialized with <b>nil</b>.


<p>
A chunk is also a block (see <a href="#2.4.1">&sect;2.4.1</a>),
and so local variables can be declared in a chunk outside any explicit block.
The scope of such local variables extends until the end of the chunk.


<p>
The visibility rules for local variables are explained in <a href="#2.6">&sect;2.6</a>.







<h2>2.5 - <a name="2.5">Expressions</a></h2>

<p>
The basic expressions in Lua are the following:

<pre>
	exp ::= prefixexp
	exp ::= <b>nil</b> | <b>false</b> | <b>true</b>
	exp ::= Number
	exp ::= String
	exp ::= function
	exp ::= tableconstructor
	exp ::= `<b>...</b>&acute;
	exp ::= exp binop exp
	exp ::= unop exp
	prefixexp ::= var | functioncall | `<b>(</b>&acute; exp `<b>)</b>&acute;
</pre>

<p>
Numbers and literal strings are explained in <a href="#2.1">&sect;2.1</a>;
variables are explained in <a href="#2.3">&sect;2.3</a>;
function definitions are explained in <a href="#2.5.9">&sect;2.5.9</a>;
function calls are explained in <a href="#2.5.8">&sect;2.5.8</a>;
table constructors are explained in <a href="#2.5.7">&sect;2.5.7</a>.
Vararg expressions,
denoted by three dots ('<code>...</code>'), can only be used when
directly inside a vararg function;
they are explained in <a href="#2.5.9">&sect;2.5.9</a>.


<p>
Binary operators comprise arithmetic operators (see <a href="#2.5.1">&sect;2.5.1</a>),
relational operators (see <a href="#2.5.2">&sect;2.5.2</a>), logical operators (see <a href="#2.5.3">&sect;2.5.3</a>),
and the concatenation operator (see <a href="#2.5.4">&sect;2.5.4</a>).
Unary operators comprise the unary minus (see <a href="#2.5.1">&sect;2.5.1</a>),
the unary <b>not</b> (see <a href="#2.5.3">&sect;2.5.3</a>),
and the unary <em>length operator</em> (see <a href="#2.5.5">&sect;2.5.5</a>).


<p>
Both function calls and vararg expressions can result in multiple values.
If an expression is used as a statement
(only possible for function calls (see <a href="#2.4.6">&sect;2.4.6</a>)),
then its return list is adjusted to zero elements,
thus discarding all returned values.
If an expression is used as the last (or the only) element
of a list of expressions,
then no adjustment is made
(unless the call is enclosed in parentheses).
In all other contexts,
Lua adjusts the result list to one element,
discarding all values except the first one.


<p>
Here are some examples:

<pre>
     f()                -- adjusted to 0 results
     g(f(), x)          -- f() is adjusted to 1 result
     g(x, f())          -- g gets x plus all results from f()
     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
     a,b = ...          -- a gets the first vararg parameter, b gets
                        -- the second (both a and b can get nil if there
                        -- is no corresponding vararg parameter)
     
     a,b,c = x, f()     -- f() is adjusted to 2 results
     a,b,c = f()        -- f() is adjusted to 3 results
     return f()         -- returns all results from f()
     return ...         -- returns all received vararg parameters
     return x,y,f()     -- returns x, y, and all results from f()
     {f()}              -- creates a list with all results from f()
     {...}              -- creates a list with all vararg parameters
     {f(), nil}         -- f() is adjusted to 1 result
</pre>

<p>
Any expression enclosed in parentheses always results in only one value.
Thus,
<code>(f(x,y,z))</code> is always a single value,
even if <code>f</code> returns several values.
(The value of <code>(f(x,y,z))</code> is the first value returned by <code>f</code>
or <b>nil</b> if <code>f</code> does not return any values.)



<h3>2.5.1 - <a name="2.5.1">Arithmetic Operators</a></h3><p>
Lua supports the usual arithmetic operators:
the binary <code>+</code> (addition),
<code>-</code> (subtraction), <code>*</code> (multiplication),
<code>/</code> (division), <code>%</code> (modulo), and <code>^</code> (exponentiation);
and unary <code>-</code> (negation).
If the operands are numbers, or strings that can be converted to
numbers (see <a href="#2.2.1">&sect;2.2.1</a>),
then all operations have the usual meaning.
Exponentiation works for any exponent.
For instance, <code>x^(-0.5)</code> computes the inverse of the square root of <code>x</code>.
Modulo is defined as

<pre>
     a % b == a - math.floor(a/b)*b
</pre><p>
That is, it is the remainder of a division that rounds
the quotient towards minus infinity.





<h3>2.5.2 - <a name="2.5.2">Relational Operators</a></h3><p>
The relational operators in Lua are

<pre>
     ==    ~=    &lt;     &gt;     &lt;=    &gt;=
</pre><p>
These operators always result in <b>false</b> or <b>true</b>.


<p>
Equality (<code>==</code>) first compares the type of its operands.
If the types are different, then the result is <b>false</b>.
Otherwise, the values of the operands are compared.
Numbers and strings are compared in the usual way.
Objects (tables, userdata, threads, and functions)
are compared by <em>reference</em>:
two objects are considered equal only if they are the <em>same</em> object.
Every time you create a new object
(a table, userdata, thread, or function),
this new object is different from any previously existing object.


<p>
You can change the way that Lua compares tables and userdata 
by using the "eq" metamethod (see <a href="#2.8">&sect;2.8</a>).


<p>
The conversion rules of <a href="#2.2.1">&sect;2.2.1</a>
<em>do not</em> apply to equality comparisons.
Thus, <code>"0"==0</code> evaluates to <b>false</b>,
and <code>t[0]</code> and <code>t["0"]</code> denote different
entries in a table.


<p>
The operator <code>~=</code> is exactly the negation of equality (<code>==</code>).


<p>
The order operators work as follows.
If both arguments are numbers, then they are compared as such.
Otherwise, if both arguments are strings,
then their values are compared according to the current locale.
Otherwise, Lua tries to call the "lt" or the "le"
metamethod (see <a href="#2.8">&sect;2.8</a>).
A comparison <code>a &gt; b</code> is translated to <code>b &lt; a</code>
and <code>a &gt;= b</code> is translated to <code>b &lt;= a</code>.





<h3>2.5.3 - <a name="2.5.3">Logical Operators</a></h3><p>
The logical operators in Lua are
<b>and</b>, <b>or</b>, and <b>not</b>.
Like the control structures (see <a href="#2.4.4">&sect;2.4.4</a>),
all logical operators consider both <b>false</b> and <b>nil</b> as false
and anything else as true.


<p>
The negation operator <b>not</b> always returns <b>false</b> or <b>true</b>.
The conjunction operator <b>and</b> returns its first argument
if this value is <b>false</b> or <b>nil</b>;
otherwise, <b>and</b> returns its second argument.
The disjunction operator <b>or</b> returns its first argument
if this value is different from <b>nil</b> and <b>false</b>;
otherwise, <b>or</b> returns its second argument.
Both <b>and</b> and <b>or</b> use short-cut evaluation;
that is,
the second operand is evaluated only if necessary.
Here are some examples:

<pre>
     10 or 20            --&gt; 10
     10 or error()       --&gt; 10
     nil or "a"          --&gt; "a"
     nil and 10          --&gt; nil
     false and error()   --&gt; false
     false and nil       --&gt; false
     false or nil        --&gt; nil
     10 and 20           --&gt; 20
</pre><p>
(In this manual,
<code>--&gt;</code> indicates the result of the preceding expression.)





<h3>2.5.4 - <a name="2.5.4">Concatenation</a></h3><p>
The string concatenation operator in Lua is
denoted by two dots ('<code>..</code>').
If both operands are strings or numbers, then they are converted to
strings according to the rules mentioned in <a href="#2.2.1">&sect;2.2.1</a>.
Otherwise, the "concat" metamethod is called (see <a href="#2.8">&sect;2.8</a>).





<h3>2.5.5 - <a name="2.5.5">The Length Operator</a></h3>

<p>
The length operator is denoted by the unary operator <code>#</code>.
The length of a string is its number of bytes
(that is, the usual meaning of string length when each
character is one byte).


<p>
The length of a table <code>t</code> is defined to be any
integer index <code>n</code>
such that <code>t[n]</code> is not <b>nil</b> and <code>t[n+1]</code> is <b>nil</b>;
moreover, if <code>t[1]</code> is <b>nil</b>, <code>n</code> can be zero.
For a regular array, with non-nil values from 1 to a given <code>n</code>,
its length is exactly that <code>n</code>,
the index of its last value.
If the array has "holes"
(that is, <b>nil</b> values between other non-nil values),
then <code>#t</code> can be any of the indices that
directly precedes a <b>nil</b> value
(that is, it may consider any such <b>nil</b> value as the end of
the array). 





<h3>2.5.6 - <a name="2.5.6">Precedence</a></h3><p>
Operator precedence in Lua follows the table below,
from lower to higher priority:

<pre>
     or
     and
     &lt;     &gt;     &lt;=    &gt;=    ~=    ==
     ..
     +     -
     *     /     %
     not   #     - (unary)
     ^
</pre><p>
As usual,
you can use parentheses to change the precedences of an expression.
The concatenation ('<code>..</code>') and exponentiation ('<code>^</code>')
operators are right associative.
All other binary operators are left associative.





<h3>2.5.7 - <a name="2.5.7">Table Constructors</a></h3><p>
Table constructors are expressions that create tables.
Every time a constructor is evaluated, a new table is created.
A constructor can be used to create an empty table
or to create a table and initialize some of its fields.
The general syntax for constructors is

<pre>
	tableconstructor ::= `<b>{</b>&acute; [fieldlist] `<b>}</b>&acute;
	fieldlist ::= field {fieldsep field} [fieldsep]
	field ::= `<b>[</b>&acute; exp `<b>]</b>&acute; `<b>=</b>&acute; exp | Name `<b>=</b>&acute; exp | exp
	fieldsep ::= `<b>,</b>&acute; | `<b>;</b>&acute;
</pre>

<p>
Each field of the form <code>[exp1] = exp2</code> adds to the new table an entry
with key <code>exp1</code> and value <code>exp2</code>.
A field of the form <code>name = exp</code> is equivalent to
<code>["name"] = exp</code>.
Finally, fields of the form <code>exp</code> are equivalent to
<code>[i] = exp</code>, where <code>i</code> are consecutive numerical integers,
starting with 1.
Fields in the other formats do not affect this counting.
For example,

<pre>
     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
</pre><p>
is equivalent to

<pre>
     do
       local t = {}
       t[f(1)] = g
       t[1] = "x"         -- 1st exp
       t[2] = "y"         -- 2nd exp
       t.x = 1            -- t["x"] = 1
       t[3] = f(x)        -- 3rd exp
       t[30] = 23
       t[4] = 45          -- 4th exp
       a = t
     end
</pre>

<p>
If the last field in the list has the form <code>exp</code>
and the expression is a function call or a vararg expression,
then all values returned by this expression enter the list consecutively
(see <a href="#2.5.8">&sect;2.5.8</a>).
To avoid this,
enclose the function call or the vararg expression
in parentheses (see <a href="#2.5">&sect;2.5</a>).


<p>
The field list can have an optional trailing separator,
as a convenience for machine-generated code.





<h3>2.5.8 - <a name="2.5.8">Function Calls</a></h3><p>
A function call in Lua has the following syntax:

<pre>
	functioncall ::= prefixexp args
</pre><p>
In a function call,
first prefixexp and args are evaluated.
If the value of prefixexp has type <em>function</em>,
then this function is called
with the given arguments.
Otherwise, the prefixexp "call" metamethod is called,
having as first parameter the value of prefixexp,
followed by the original call arguments
(see <a href="#2.8">&sect;2.8</a>).


<p>
The form

<pre>
	functioncall ::= prefixexp `<b>:</b>&acute; Name args
</pre><p>
can be used to call "methods".
A call <code>v:name(<em>args</em>)</code>
is syntactic sugar for <code>v.name(v,<em>args</em>)</code>,
except that <code>v</code> is evaluated only once.


<p>
Arguments have the following syntax:

<pre>
	args ::= `<b>(</b>&acute; [explist] `<b>)</b>&acute;
	args ::= tableconstructor
	args ::= String
</pre><p>
All argument expressions are evaluated before the call.
A call of the form <code>f{<em>fields</em>}</code> is
syntactic sugar for <code>f({<em>fields</em>})</code>;
that is, the argument list is a single new table.
A call of the form <code>f'<em>string</em>'</code>
(or <code>f"<em>string</em>"</code> or <code>f[[<em>string</em>]]</code>)
is syntactic sugar for <code>f('<em>string</em>')</code>;
that is, the argument list is a single literal string.


<p>
As an exception to the free-format syntax of Lua,
you cannot put a line break before the '<code>(</code>' in a function call.
This restriction avoids some ambiguities in the language.
If you write

<pre>
     a = f
     (g).x(a)
</pre><p>
Lua would see that as a single statement, <code>a = f(g).x(a)</code>.
So, if you want two statements, you must add a semi-colon between them.
If you actually want to call <code>f</code>,
you must remove the line break before <code>(g)</code>.


<p>
A call of the form <code>return</code> <em>functioncall</em> is called
a <em>tail call</em>.
Lua implements <em>proper tail calls</em>
(or <em>proper tail recursion</em>):
in a tail call,
the called function reuses the stack entry of the calling function.
Therefore, there is no limit on the number of nested tail calls that
a program can execute.
However, a tail call erases any debug information about the
calling function.
Note that a tail call only happens with a particular syntax,
where the <b>return</b> has one single function call as argument;
this syntax makes the calling function return exactly
the returns of the called function.
So, none of the following examples are tail calls:

<pre>
     return (f(x))        -- results adjusted to 1
     return 2 * f(x)
     return x, f(x)       -- additional results
     f(x); return         -- results discarded
     return x or f(x)     -- results adjusted to 1
</pre>




<h3>2.5.9 - <a name="2.5.9">Function Definitions</a></h3>

<p>
The syntax for function definition is

<pre>
	function ::= <b>function</b> funcbody
	funcbody ::= `<b>(</b>&acute; [parlist] `<b>)</b>&acute; block <b>end</b>
</pre>

<p>
The following syntactic sugar simplifies function definitions:

<pre>
	stat ::= <b>function</b> funcname funcbody
	stat ::= <b>local</b> <b>function</b> Name funcbody
	funcname ::= Name {`<b>.</b>&acute; Name} [`<b>:</b>&acute; Name]
</pre><p>
The statement

<pre>
     function f () <em>body</em> end
</pre><p>
translates to

<pre>
     f = function () <em>body</em> end
</pre><p>
The statement

<pre>
     function t.a.b.c.f () <em>body</em> end
</pre><p>
translates to

<pre>
     t.a.b.c.f = function () <em>body</em> end
</pre><p>
The statement

<pre>
     local function f () <em>body</em> end
</pre><p>
translates to

<pre>
     local f; f = function () <em>body</em> end
</pre><p>
<em>not</em> to

<pre>
     local f = function () <em>body</em> end
</pre><p>
(This only makes a difference when the body of the function
contains references to <code>f</code>.)


<p>
A function definition is an executable expression,
whose value has type <em>function</em>.
When Lua pre-compiles a chunk,
all its function bodies are pre-compiled too.
Then, whenever Lua executes the function definition,
the function is <em>instantiated</em> (or <em>closed</em>).
This function instance (or <em>closure</em>)
is the final value of the expression.
Different instances of the same function
can refer to different  external local variables
and can have different environment tables.


<p>
Parameters act as local variables that are
initialized with the argument values:

<pre>
	parlist ::= namelist [`<b>,</b>&acute; `<b>...</b>&acute;] | `<b>...</b>&acute;
</pre><p>
When a function is called,
the list of arguments is adjusted to
the length of the list of parameters,
unless the function is a variadic or <em>vararg function</em>,
which is
indicated by three dots ('<code>...</code>') at the end of its parameter list.
A vararg function does not adjust its argument list;
instead, it collects all extra arguments and supplies them
to the function through a <em>vararg expression</em>,
which is also written as three dots.
The value of this expression is a list of all actual extra arguments,
similar to a function with multiple results.
If a vararg expression is used inside another expression
or in the middle of a list of expressions,
then its return list is adjusted to one element.
If the expression is used as the last element of a list of expressions,
then no adjustment is made
(unless that last expression is enclosed in parentheses).


<p>
As an example, consider the following definitions:

<pre>
     function f(a, b) end
     function g(a, b, ...) end
     function r() return 1,2,3 end
</pre><p>
Then, we have the following mapping from arguments to parameters and
to the vararg expression:

<pre>
     CALL            PARAMETERS
     
     f(3)             a=3, b=nil
     f(3, 4)          a=3, b=4
     f(3, 4, 5)       a=3, b=4
     f(r(), 10)       a=1, b=10
     f(r())           a=1, b=2
     
     g(3)             a=3, b=nil, ... --&gt;  (nothing)
     g(3, 4)          a=3, b=4,   ... --&gt;  (nothing)
     g(3, 4, 5, 8)    a=3, b=4,   ... --&gt;  5  8
     g(5, r())        a=5, b=1,   ... --&gt;  2  3
</pre>

<p>
Results are returned using the <b>return</b> statement (see <a href="#2.4.4">&sect;2.4.4</a>).
If control reaches the end of a function
without encountering a <b>return</b> statement,
then the function returns with no results.


<p>
The <em>colon</em> syntax
is used for defining <em>methods</em>,
that is, functions that have an implicit extra parameter <code>self</code>.
Thus, the statement

<pre>
     function t.a.b.c:f (<em>params</em>) <em>body</em> end
</pre><p>
is syntactic sugar for

<pre>
     t.a.b.c.f = function (self, <em>params</em>) <em>body</em> end
</pre>






<h2>2.6 - <a name="2.6">Visibility Rules</a></h2>

<p>

Lua is a lexically scoped language.
The scope of variables begins at the first statement <em>after</em>
their declaration and lasts until the end of the innermost block that
includes the declaration.
Consider the following example:

<pre>
     x = 10                -- global variable
     do                    -- new block
       local x = x         -- new 'x', with value 10
       print(x)            --&gt; 10
       x = x+1
       do                  -- another block
         local x = x+1     -- another 'x'
         print(x)          --&gt; 12
       end
       print(x)            --&gt; 11
     end
     print(x)              --&gt; 10  (the global one)
</pre>

<p>
Notice that, in a declaration like <code>local x = x</code>,
the new <code>x</code> being declared is not in scope yet,
and so the second <code>x</code> refers to the outside variable.


<p>
Because of the lexical scoping rules,
local variables can be freely accessed by functions
defined inside their scope.
A local variable used by an inner function is called
an <em>upvalue</em>, or <em>external local variable</em>,
inside the inner function.


<p>
Notice that each execution of a <b>local</b> statement
defines new local variables.
Consider the following example:

<pre>
     a = {}
     local x = 20
     for i=1,10 do
       local y = 0
       a[i] = function () y=y+1; return x+y end
     end
</pre><p>
The loop creates ten closures
(that is, ten instances of the anonymous function).
Each of these closures uses a different <code>y</code> variable,
while all of them share the same <code>x</code>.





<h2>2.7 - <a name="2.7">Error Handling</a></h2>

<p>
Because Lua is an embedded extension language,
all Lua actions start from C&nbsp;code in the host program
calling a function from the Lua library (see <a href="#lua_pcall"><code>lua_pcall</code></a>).
Whenever an error occurs during Lua compilation or execution,
control returns to C,
which can take appropriate measures
(such as printing an error message).


<p>
Lua code can explicitly generate an error by calling the
<a href="#pdf-error"><code>error</code></a> function.
If you need to catch errors in Lua,
you can use the <a href="#pdf-pcall"><code>pcall</code></a> function.





<h2>2.8 - <a name="2.8">Metatables</a></h2>

<p>
Every value in Lua can have a <em>metatable</em>.
This <em>metatable</em> is an ordinary Lua table
that defines the behavior of the original value
under certain special operations.
You can change several aspects of the behavior
of operations over a value by setting specific fields in its metatable.
For instance, when a non-numeric value is the operand of an addition,
Lua checks for a function in the field <code>"__add"</code> in its metatable.
If it finds one,
Lua calls this function to perform the addition.


<p>
We call the keys in a metatable <em>events</em>
and the values <em>metamethods</em>.
In the previous example, the event is <code>"add"</code> 
and the metamethod is the function that performs the addition.


<p>
You can query the metatable of any value
through the <a href="#pdf-getmetatable"><code>getmetatable</code></a> function.


<p>
You can replace the metatable of tables
through the <a href="#pdf-setmetatable"><code>setmetatable</code></a>
function.
You cannot change the metatable of other types from Lua
(except by using the debug library);
you must use the C&nbsp;API for that.


<p>
Tables and full userdata have individual metatables
(although multiple tables and userdata can share their metatables).
Values of all other types share one single metatable per type;
that is, there is one single metatable for all numbers,
one for all strings, etc.


<p>
A metatable controls how an object behaves in arithmetic operations,
order comparisons, concatenation, length operation, and indexing.
A metatable also can define a function to be called when a userdata
is garbage collected.
For each of these operations Lua associates a specific key
called an <em>event</em>.
When Lua performs one of these operations over a value,
it checks whether this value has a metatable with the corresponding event.
If so, the value associated with that key (the metamethod)
controls how Lua will perform the operation.


<p>
Metatables control the operations listed next.
Each operation is identified by its corresponding name.
The key for each operation is a string with its name prefixed by
two underscores, '<code>__</code>';
for instance, the key for operation "add" is the
string <code>"__add"</code>.
The semantics of these operations is better explained by a Lua function
describing how the interpreter executes the operation.


<p>
The code shown here in Lua is only illustrative;
the real behavior is hard coded in the interpreter
and it is much more efficient than this simulation.
All functions used in these descriptions
(<a href="#pdf-rawget"><code>rawget</code></a>, <a href="#pdf-tonumber"><code>tonumber</code></a>, etc.)
are described in <a href="#5.1">&sect;5.1</a>.
In particular, to retrieve the metamethod of a given object,
we use the expression

<pre>
     metatable(obj)[event]
</pre><p>
This should be read as

<pre>
     rawget(getmetatable(obj) or {}, event)
</pre><p>

That is, the access to a metamethod does not invoke other metamethods,
and the access to objects with no metatables does not fail
(it simply results in <b>nil</b>).



<ul>

<li><b>"add":</b>
the <code>+</code> operation.



<p>
The function <code>getbinhandler</code> below defines how Lua chooses a handler
for a binary operation.
First, Lua tries the first operand.
If its type does not define a handler for the operation,
then Lua tries the second operand.

<pre>
     function getbinhandler (op1, op2, event)
       return metatable(op1)[event] or metatable(op2)[event]
     end
</pre><p>
By using this function,
the behavior of the <code>op1 + op2</code> is

<pre>
     function add_event (op1, op2)
       local o1, o2 = tonumber(op1), tonumber(op2)
       if o1 and o2 then  -- both operands are numeric?
         return o1 + o2   -- '+' here is the primitive 'add'
       else  -- at least one of the operands is not numeric
         local h = getbinhandler(op1, op2, "__add")
         if h then
           -- call the handler with both operands
           return (h(op1, op2))
         else  -- no handler available: default behavior
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
</li>

<li><b>"sub":</b>
the <code>-</code> operation.

Behavior similar to the "add" operation.
</li>

<li><b>"mul":</b>
the <code>*</code> operation.

Behavior similar to the "add" operation.
</li>

<li><b>"div":</b>
the <code>/</code> operation.

Behavior similar to the "add" operation.
</li>

<li><b>"mod":</b>
the <code>%</code> operation.

Behavior similar to the "add" operation,
with the operation
<code>o1 - floor(o1/o2)*o2</code> as the primitive operation.
</li>

<li><b>"pow":</b>
the <code>^</code> (exponentiation) operation.

Behavior similar to the "add" operation,
with the function <code>pow</code> (from the C&nbsp;math library)
as the primitive operation.
</li>

<li><b>"unm":</b>
the unary <code>-</code> operation.


<pre>
     function unm_event (op)
       local o = tonumber(op)
       if o then  -- operand is numeric?
         return -o  -- '-' here is the primitive 'unm'
       else  -- the operand is not numeric.
         -- Try to get a handler from the operand
         local h = metatable(op).__unm
         if h then
           -- call the handler with the operand
           return (h(op))
         else  -- no handler available: default behavior
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
</li>

<li><b>"concat":</b>
the <code>..</code> (concatenation) operation.


<pre>
     function concat_event (op1, op2)
       if (type(op1) == "string" or type(op1) == "number") and
          (type(op2) == "string" or type(op2) == "number") then
         return op1 .. op2  -- primitive string concatenation
       else
         local h = getbinhandler(op1, op2, "__concat")
         if h then
           return (h(op1, op2))
         else
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
</li>

<li><b>"len":</b>
the <code>#</code> operation.


<pre>
     function len_event (op)
       if type(op) == "string" then
         return strlen(op)         -- primitive string length
       elseif type(op) == "table" then
         return #op                -- primitive table length
       else
         local h = metatable(op).__len
         if h then
           -- call the handler with the operand
           return (h(op))
         else  -- no handler available: default behavior
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
See <a href="#2.5.5">&sect;2.5.5</a> for a description of the length of a table.
</li>

<li><b>"eq":</b>
the <code>==</code> operation.

The function <code>getcomphandler</code> defines how Lua chooses a metamethod
for comparison operators.
A metamethod only is selected when both objects
being compared have the same type
and the same metamethod for the selected operation.

<pre>
     function getcomphandler (op1, op2, event)
       if type(op1) ~= type(op2) then return nil end
       local mm1 = metatable(op1)[event]
       local mm2 = metatable(op2)[event]
       if mm1 == mm2 then return mm1 else return nil end
     end
</pre><p>
The "eq" event is defined as follows:

<pre>
     function eq_event (op1, op2)
       if type(op1) ~= type(op2) then  -- different types?
         return false   -- different objects
       end
       if op1 == op2 then   -- primitive equal?
         return true   -- objects are equal
       end
       -- try metamethod
       local h = getcomphandler(op1, op2, "__eq")
       if h then
         return (h(op1, op2))
       else
         return false
       end
     end
</pre><p>
<code>a ~= b</code> is equivalent to <code>not (a == b)</code>.
</li>

<li><b>"lt":</b>
the <code>&lt;</code> operation.


<pre>
     function lt_event (op1, op2)
       if type(op1) == "number" and type(op2) == "number" then
         return op1 &lt; op2   -- numeric comparison
       elseif type(op1) == "string" and type(op2) == "string" then
         return op1 &lt; op2   -- lexicographic comparison
       else
         local h = getcomphandler(op1, op2, "__lt")
         if h then
           return (h(op1, op2))
         else
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
<code>a &gt; b</code> is equivalent to <code>b &lt; a</code>.
</li>

<li><b>"le":</b>
the <code>&lt;=</code> operation.


<pre>
     function le_event (op1, op2)
       if type(op1) == "number" and type(op2) == "number" then
         return op1 &lt;= op2   -- numeric comparison
       elseif type(op1) == "string" and type(op2) == "string" then
         return op1 &lt;= op2   -- lexicographic comparison
       else
         local h = getcomphandler(op1, op2, "__le")
         if h then
           return (h(op1, op2))
         else
           h = getcomphandler(op1, op2, "__lt")
           if h then
             return not h(op2, op1)
           else
             error(&middot;&middot;&middot;)
           end
         end
       end
     end
</pre><p>
<code>a &gt;= b</code> is equivalent to <code>b &lt;= a</code>.
Note that, in the absence of a "le" metamethod,
Lua tries the "lt", assuming that <code>a &lt;= b</code> is
equivalent to <code>not (b &lt; a)</code>.
</li>

<li><b>"index":</b>
The indexing access <code>table[key]</code>.


<pre>
     function gettable_event (table, key)
       local h
       if type(table) == "table" then
         local v = rawget(table, key)
         if v ~= nil then return v end
         h = metatable(table).__index
         if h == nil then return nil end
       else
         h = metatable(table).__index
         if h == nil then
           error(&middot;&middot;&middot;)
         end
       end
       if type(h) == "function" then
         return (h(table, key))     -- call the handler
       else return h[key]           -- or repeat operation on it
       end
     end
</pre><p>
</li>

<li><b>"newindex":</b>
The indexing assignment <code>table[key] = value</code>.


<pre>
     function settable_event (table, key, value)
       local h
       if type(table) == "table" then
         local v = rawget(table, key)
         if v ~= nil then rawset(table, key, value); return end
         h = metatable(table).__newindex
         if h == nil then rawset(table, key, value); return end
       else
         h = metatable(table).__newindex
         if h == nil then
           error(&middot;&middot;&middot;)
         end
       end
       if type(h) == "function" then
         h(table, key,value)           -- call the handler
       else h[key] = value             -- or repeat operation on it
       end
     end
</pre><p>
</li>

<li><b>"call":</b>
called when Lua calls a value.


<pre>
     function function_event (func, ...)
       if type(func) == "function" then
         return func(...)   -- primitive call
       else
         local h = metatable(func).__call
         if h then
           return h(func, ...)
         else
           error(&middot;&middot;&middot;)
         end
       end
     end
</pre><p>
</li>

</ul>




<h2>2.9 - <a name="2.9">Environments</a></h2>

<p>
Besides metatables,
objects of types thread, function, and userdata
have another table associated with them,
called their <em>environment</em>.
Like metatables, environments are regular tables and
multiple objects can share the same environment.


<p>
Threads are created sharing the environment of the creating thread.
Userdata and C&nbsp;functions are created sharing the environment
of the creating C&nbsp;function.
Non-nested Lua functions
(created by <a href="#pdf-loadfile"><code>loadfile</code></a>, <a href="#pdf-loadstring"><code>loadstring</code></a> or <a href="#pdf-load"><code>load</code></a>)
are created sharing the environment of the creating thread.
Nested Lua functions are created sharing the environment of
the creating Lua function.


<p>
Environments associated with userdata have no meaning for Lua.
It is only a convenience feature for programmers to associate a table to
a userdata.


<p>
Environments associated with threads are called
<em>global environments</em>.
They are used as the default environment for threads and
non-nested Lua functions created by the thread
and can be directly accessed by C&nbsp;code (see <a href="#3.3">&sect;3.3</a>).


<p>
The environment associated with a C&nbsp;function can be directly
accessed by C&nbsp;code (see <a href="#3.3">&sect;3.3</a>).
It is used as the default environment for other C&nbsp;functions
and userdata created by the function.


<p>
Environments associated with Lua functions are used to resolve
all accesses to global variables within the function (see <a href="#2.3">&sect;2.3</a>).
They are used as the default environment for nested Lua functions
created by the function.


<p>
You can change the environment of a Lua function or the
running thread by calling <a href="#pdf-setfenv"><code>setfenv</code></a>.
You can get the environment of a Lua function or the running thread
by calling <a href="#pdf-getfenv"><code>getfenv</code></a>.
To manipulate the environment of other objects
(userdata, C&nbsp;functions, other threads) you must
use the C&nbsp;API.





<h2>2.10 - <a name="2.10">Garbage Collection</a></h2>

<p>
Lua performs automatic memory management.
This means that
you have to worry neither about allocating memory for new objects
nor about freeing it when the objects are no longer needed.
Lua manages memory automatically by running
a <em>garbage collector</em> from time to time
to collect all <em>dead objects</em>
(that is, objects that are no longer accessible from Lua).
All memory used by Lua is subject to automatic management:
tables, userdata, functions, threads, strings, etc.


<p>
Lua implements an incremental mark-and-sweep collector.
It uses two numbers to control its garbage-collection cycles:
the <em>garbage-collector pause</em> and
the <em>garbage-collector step multiplier</em>.
Both use percentage points as units
(so that a value of 100 means an internal value of 1).


<p>
The garbage-collector pause
controls how long the collector waits before starting a new cycle.
Larger values make the collector less aggressive.
Values smaller than 100 mean the collector will not wait to
start a new cycle.
A value of 200 means that the collector waits for the total memory in use
to double before starting a new cycle.


<p>
The step multiplier
controls the relative speed of the collector relative to
memory allocation.
Larger values make the collector more aggressive but also increase
the size of each incremental step.
Values smaller than 100 make the collector too slow and
can result in the collector never finishing a cycle.
The default, 200, means that the collector runs at "twice"
the speed of memory allocation.


<p>
You can change these numbers by calling <a href="#lua_gc"><code>lua_gc</code></a> in C
or <a href="#pdf-collectgarbage"><code>collectgarbage</code></a> in Lua.
With these functions you can also control 
the collector directly (e.g., stop and restart it).



<h3>2.10.1 - <a name="2.10.1">Garbage-Collection Metamethods</a></h3>

<p>
Using the C&nbsp;API,
you can set garbage-collector metamethods for userdata (see <a href="#2.8">&sect;2.8</a>).
These metamethods are also called <em>finalizers</em>.
Finalizers allow you to coordinate Lua's garbage collection
with external resource management
(such as closing files, network or database connections,
or freeing your own memory).


<p>
Garbage userdata with a field <code>__gc</code> in their metatables are not
collected immediately by the garbage collector.
Instead, Lua puts them in a list.
After the collection,
Lua does the equivalent of the following function
for each userdata in that list:

<pre>
     function gc_event (udata)
       local h = metatable(udata).__gc
       if h then
         h(udata)
       end
     end
</pre>

<p>
At the end of each garbage-collection cycle,
the finalizers for userdata are called in <em>reverse</em>
order of their creation,
among those collected in that cycle.
That is, the first finalizer to be called is the one associated
with the userdata created last in the program.
The userdata itself is freed only in the next garbage-collection cycle.





<h3>2.10.2 - <a name="2.10.2">Weak Tables</a></h3>

<p>
A <em>weak table</em> is a table whose elements are
<em>weak references</em>.
A weak reference is ignored by the garbage collector.
In other words,
if the only references to an object are weak references,
then the garbage collector will collect this object.


<p>
A weak table can have weak keys, weak values, or both.
A table with weak keys allows the collection of its keys,
but prevents the collection of its values.
A table with both weak keys and weak values allows the collection of
both keys and values.
In any case, if either the key or the value is collected,
the whole pair is removed from the table.
The weakness of a table is controlled by the
<code>__mode</code> field of its metatable.
If the <code>__mode</code> field is a string containing the character&nbsp;'<code>k</code>',
the keys in the table are weak.
If <code>__mode</code> contains '<code>v</code>',
the values in the table are weak.


<p>
After you use a table as a metatable,
you should not change the value of its <code>__mode</code> field.
Otherwise, the weak behavior of the tables controlled by this
metatable is undefined.







<h2>2.11 - <a name="2.11">Coroutines</a></h2>

<p>
Lua supports coroutines,
also called <em>collaborative multithreading</em>.
A coroutine in Lua represents an independent thread of execution.
Unlike threads in multithread systems, however,
a coroutine only suspends its execution by explicitly calling
a yield function.


<p>
You create a coroutine with a call to <a href="#pdf-coroutine.create"><code>coroutine.create</code></a>.
Its sole argument is a function
that is the main function of the coroutine.
The <code>create</code> function only creates a new coroutine and
returns a handle to it (an object of type <em>thread</em>);
it does not start the coroutine execution.


<p>
When you first call <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a>,
passing as its first argument
a thread returned by <a href="#pdf-coroutine.create"><code>coroutine.create</code></a>,
the coroutine starts its execution,
at the first line of its main function.
Extra arguments passed to <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a> are passed on
to the coroutine main function.
After the coroutine starts running,
it runs until it terminates or <em>yields</em>.


<p>
A coroutine can terminate its execution in two ways:
normally, when its main function returns
(explicitly or implicitly, after the last instruction);
and abnormally, if there is an unprotected error.
In the first case, <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a> returns <b>true</b>,
plus any values returned by the coroutine main function.
In case of errors, <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a> returns <b>false</b>
plus an error message.


<p>
A coroutine yields by calling <a href="#pdf-coroutine.yield"><code>coroutine.yield</code></a>.
When a coroutine yields,
the corresponding <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a> returns immediately,
even if the yield happens inside nested function calls
(that is, not in the main function,
but in a function directly or indirectly called by the main function).
In the case of a yield, <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a> also returns <b>true</b>,
plus any values passed to <a href="#pdf-coroutine.yield"><code>coroutine.yield</code></a>.
The next time you resume the same coroutine,
it continues its execution from the point where it yielded,
with the call to <a href="#pdf-coroutine.yield"><code>coroutine.yield</code></a> returning any extra
arguments passed to <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a>.


<p>
Like <a href="#pdf-coroutine.create"><code>coroutine.create</code></a>,
the <a href="#pdf-coroutine.wrap"><code>coroutine.wrap</code></a> function also creates a coroutine,
but instead of returning the coroutine itself,
it returns a function that, when called, resumes the coroutine.
Any arguments passed to this function
go as extra arguments to <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a>.
<a href="#pdf-coroutine.wrap"><code>coroutine.wrap</code></a> returns all the values returned by <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a>,
except the first one (the boolean error code).
Unlike <a href="#pdf-coroutine.resume"><code>coroutine.resume</code></a>,
<a href="#pdf-coroutine.wrap"><code>coroutine.wrap</code></a> does not catch errors;
any error is propagated to the caller.


<p>
As an example,
consider the following code:

<pre>
     function foo (a)
       print("foo", a)
       return coroutine.yield(2*a)
     end
     
     co = coroutine.create(function (a,b)
           print("co-body", a, b)
           local r = foo(a+1)
           print("co-body", r)
           local r, s = coroutine.yield(a+b, a-b)
           print("co-body", r, s)
           return b, "end"
     end)
            
     print("main", coroutine.resume(co, 1, 10))
     print("main", coroutine.resume(co, "r"))
     print("main", coroutine.resume(co, "x", "y"))
     print("main", coroutine.resume(co, "x", "y"))
</pre><p>
When you run it, it produces the following output:

<pre>
     co-body 1       10
     foo     2
     
     main    true    4
     co-body r
     main    true    11      -9
     co-body x       y
     main    true    10      end
     main    false   cannot resume dead coroutine
</pre>




<h1>3 - <a name="3">The Application Program Interface</a></h1>

<p>

This section describes the C&nbsp;API for Lua, that is,
the set of C&nbsp;functions available to the host program to communicate
with Lua.
All API functions and related types and constants
are declared in the header file <a name="pdf-lua.h"><code>lua.h</code></a>.


<p>
Even when we use the term "function",
any facility in the API may be provided as a macro instead.
All such macros use each of their arguments exactly once
(except for the first argument, which is always a Lua state),
and so do not generate any hidden side-effects.


<p>
As in most C&nbsp;libraries,
the Lua API functions do not check their arguments for validity or consistency.
However, you can change this behavior by compiling Lua
with a proper definition for the macro <a name="pdf-luai_apicheck"><code>luai_apicheck</code></a>,
in file <code>luaconf.h</code>.



<h2>3.1 - <a name="3.1">The Stack</a></h2>

<p>
Lua uses a <em>virtual stack</em> to pass values to and from C.
Each element in this stack represents a Lua value
(<b>nil</b>, number, string, etc.).


<p>
Whenever Lua calls C, the called function gets a new stack,
which is independent of previous stacks and of stacks of
C&nbsp;functions that are still active.
This stack initially contains any arguments to the C&nbsp;function
and it is where the C&nbsp;function pushes its results
to be returned to the caller (see <a href="#lua_CFunction"><code>lua_CFunction</code></a>).


<p>
For convenience,
most query operations in the API do not follow a strict stack discipline.
Instead, they can refer to any element in the stack
by using an <em>index</em>:
A positive index represents an <em>absolute</em> stack position
(starting at&nbsp;1);
a negative index represents an <em>offset</em> relative to the top of the stack.
More specifically, if the stack has <em>n</em> elements,
then index&nbsp;1 represents the first element
(that is, the element that was pushed onto the stack first)
and
index&nbsp;<em>n</em> represents the last element;
index&nbsp;-1 also represents the last element
(that is, the element at the&nbsp;top)
and index <em>-n</em> represents the first element.
We say that an index is <em>valid</em>
if it lies between&nbsp;1 and the stack top
(that is, if <code>1 &le; abs(index) &le; top</code>).
 





<h2>3.2 - <a name="3.2">Stack Size</a></h2>

<p>
When you interact with Lua API,
you are responsible for ensuring consistency.
In particular,
<em>you are responsible for controlling stack overflow</em>.
You can use the function <a href="#lua_checkstack"><code>lua_checkstack</code></a>
to grow the stack size.


<p>
Whenever Lua calls C,
it ensures that at least <a name="pdf-LUA_MINSTACK"><code>LUA_MINSTACK</code></a> stack positions are available.
<code>LUA_MINSTACK</code> is defined as 20,
so that usually you do not have to worry about stack space
unless your code has loops pushing elements onto the stack.


<p>
Most query functions accept as indices any value inside the
available stack space, that is, indices up to the maximum stack size
you have set through <a href="#lua_checkstack"><code>lua_checkstack</code></a>.
Such indices are called <em>acceptable indices</em>.
More formally, we define an <em>acceptable index</em>
as follows:

<pre>
     (index &lt; 0 &amp;&amp; abs(index) &lt;= top) ||
     (index &gt; 0 &amp;&amp; index &lt;= stackspace)
</pre><p>
Note that 0 is never an acceptable index.





<h2>3.3 - <a name="3.3">Pseudo-Indices</a></h2>

<p>
Unless otherwise noted,
any function that accepts valid indices can also be called with
<em>pseudo-indices</em>,
which represent some Lua values that are accessible to C&nbsp;code
but which are not in the stack.
Pseudo-indices are used to access the thread environment,
the function environment,
the registry,
and the upvalues of a C&nbsp;function (see <a href="#3.4">&sect;3.4</a>).


<p>
The thread environment (where global variables live) is
always at pseudo-index <a name="pdf-LUA_GLOBALSINDEX"><code>LUA_GLOBALSINDEX</code></a>.
The environment of the running C&nbsp;function is always
at pseudo-index <a name="pdf-LUA_ENVIRONINDEX"><code>LUA_ENVIRONINDEX</code></a>.


<p>
To access and change the value of global variables,
you can use regular table operations over an environment table.
For instance, to access the value of a global variable, do

<pre>
     lua_getfield(L, LUA_GLOBALSINDEX, varname);
</pre>




<h2>3.4 - <a name="3.4">C Closures</a></h2>

<p>
When a C&nbsp;function is created,
it is possible to associate some values with it,
thus creating a <em>C&nbsp;closure</em>;
these values are called <em>upvalues</em> and are
accessible to the function whenever it is called
(see <a href="#lua_pushcclosure"><code>lua_pushcclosure</code></a>).


<p>
Whenever a C&nbsp;function is called,
its upvalues are located at specific pseudo-indices.
These pseudo-indices are produced by the macro
<a name="lua_upvalueindex"><code>lua_upvalueindex</code></a>.
The first value associated with a function is at position
<code>lua_upvalueindex(1)</code>, and so on.
Any access to <code>lua_upvalueindex(<em>n</em>)</code>,
where <em>n</em> is greater than the number of upvalues of the
current function (but not greater than 256),
produces an acceptable (but invalid) index.





<h2>3.5 - <a name="3.5">Registry</a></h2>

<p>
Lua provides a <em>registry</em>,
a pre-defined table that can be used by any C&nbsp;code to
store whatever Lua value it needs to store.
This table is always located at pseudo-index
<a name="pdf-LUA_REGISTRYINDEX"><code>LUA_REGISTRYINDEX</code></a>.
Any C&nbsp;library can store data into this table,
but it should take care to choose keys different from those used
by other libraries, to avoid collisions.
Typically, you should use as key a string containing your library name
or a light userdata with the address of a C&nbsp;object in your code.


<p>
The integer keys in the registry are used by the reference mechanism,
implemented by the auxiliary library,
and therefore should not be used for other purposes.





<h2>3.6 - <a name="3.6">Error Handling in C</a></h2>

<p>
Internally, Lua uses the C <code>longjmp</code> facility to handle errors.
(You can also choose to use exceptions if you use C++;
see file <code>luaconf.h</code>.)
When Lua faces any error
(such as memory allocation errors, type errors, syntax errors,
and runtime errors)
it <em>raises</em> an error;
that is, it does a long jump.
A <em>protected environment</em> uses <code>setjmp</code>
to set a recover point;
any error jumps to the most recent active recover point.


<p>
Most functions in the API can throw an error,
for instance due to a memory allocation error.
The documentation for each function indicates whether
it can throw errors.


<p>
Inside a C&nbsp;function you can throw an error by calling <a href="#lua_error"><code>lua_error</code></a>.





<h2>3.7 - <a name="3.7">Functions and Types</a></h2>

<p>
Here we list all functions and types from the C&nbsp;API in
alphabetical order.
Each function has an indicator like this:
<span class="apii">[-o, +p, <em>x</em>]</span>


<p>
The first field, <code>o</code>,
is how many elements the function pops from the stack.
The second field, <code>p</code>,
is how many elements the function pushes onto the stack.
(Any function always pushes its results after popping its arguments.)
A field in the form <code>x|y</code> means the function can push (or pop)
<code>x</code> or <code>y</code> elements,
depending on the situation;
an interrogation mark '<code>?</code>' means that
we cannot know how many elements the function pops/pushes
by looking only at its arguments
(e.g., they may depend on what is on the stack).
The third field, <code>x</code>,
tells whether the function may throw errors:
'<code>-</code>' means the function never throws any error;
'<code>m</code>' means the function may throw an error
only due to not enough memory;
'<code>e</code>' means the function may throw other kinds of errors;
'<code>v</code>' means the function may throw an error on purpose.



<hr><h3><a name="lua_Alloc"><code>lua_Alloc</code></a></h3>
<pre>typedef void * (*lua_Alloc) (void *ud,
                             void *ptr,
                             size_t osize,
                             size_t nsize);</pre>

<p>
The type of the memory-allocation function used by Lua states.
The allocator function must provide a
functionality similar to <code>realloc</code>,
but not exactly the same.
Its arguments are
<code>ud</code>, an opaque pointer passed to <a href="#lua_newstate"><code>lua_newstate</code></a>;
<code>ptr</code>, a pointer to the block being allocated/reallocated/freed;
<code>osize</code>, the original size of the block;
<code>nsize</code>, the new size of the block.
<code>ptr</code> is <code>NULL</code> if and only if <code>osize</code> is zero.
When <code>nsize</code> is zero, the allocator must return <code>NULL</code>;
if <code>osize</code> is not zero,
it should free the block pointed to by <code>ptr</code>.
When <code>nsize</code> is not zero, the allocator returns <code>NULL</code>
if and only if it cannot fill the request.
When <code>nsize</code> is not zero and <code>osize</code> is zero,
the allocator should behave like <code>malloc</code>.
When <code>nsize</code> and <code>osize</code> are not zero,
the allocator behaves like <code>realloc</code>.
Lua assumes that the allocator never fails when
<code>osize &gt;= nsize</code>.


<p>
Here is a simple implementation for the allocator function.
It is used in the auxiliary library by <a href="#luaL_newstate"><code>luaL_newstate</code></a>.

<pre>
     static void *l_alloc (void *ud, void *ptr, size_t osize,
                                                size_t nsize) {
       (void)ud;  (void)osize;  /* not used */
       if (nsize == 0) {
         free(ptr);
         return NULL;
       }
       else
         return realloc(ptr, nsize);
     }
</pre><p>
This code assumes
that <code>free(NULL)</code> has no effect and that
<code>realloc(NULL, size)</code> is equivalent to <code>malloc(size)</code>.
ANSI&nbsp;C ensures both behaviors.





<hr><h3><a name="lua_atpanic"><code>lua_atpanic</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre>

<p>
Sets a new panic function and returns the old one.


<p>
If an error happens outside any protected environment,
Lua calls a <em>panic function</em>
and then calls <code>exit(EXIT_FAILURE)</code>,
thus exiting the host application.
Your panic function can avoid this exit by
never returning (e.g., doing a long jump).


<p>
The panic function can access the error message at the top of the stack.





<hr><h3><a name="lua_call"><code>lua_call</code></a></h3><p>
<span class="apii">[-(nargs + 1), +nresults, <em>e</em>]</span>
<pre>void lua_call (lua_State *L, int nargs, int nresults);</pre>

<p>
Calls a function.


<p>
To call a function you must use the following protocol:
first, the function to be called is pushed onto the stack;
then, the arguments to the function are pushed
in direct order;
that is, the first argument is pushed first.
Finally you call <a href="#lua_call"><code>lua_call</code></a>;
<code>nargs</code> is the number of arguments that you pushed onto the stack.
All arguments and the function value are popped from the stack
when the function is called.
The function results are pushed onto the stack when the function returns.
The number of results is adjusted to <code>nresults</code>,
unless <code>nresults</code> is <a name="pdf-LUA_MULTRET"><code>LUA_MULTRET</code></a>.
In this case, <em>all</em> results from the function are pushed.
Lua takes care that the returned values fit into the stack space.
The function results are pushed onto the stack in direct order
(the first result is pushed first),
so that after the call the last result is on the top of the stack.


<p>
Any error inside the called function is propagated upwards
(with a <code>longjmp</code>).


<p>
The following example shows how the host program can do the
equivalent to this Lua code:

<pre>
     a = f("how", t.x, 14)
</pre><p>
Here it is in&nbsp;C:

<pre>
     lua_getfield(L, LUA_GLOBALSINDEX, "f"); /* function to be called */
     lua_pushstring(L, "how");                        /* 1st argument */
     lua_getfield(L, LUA_GLOBALSINDEX, "t");   /* table to be indexed */
     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
     lua_remove(L, -2);                  /* remove 't' from the stack */
     lua_pushinteger(L, 14);                          /* 3rd argument */
     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
     lua_setfield(L, LUA_GLOBALSINDEX, "a");        /* set global 'a' */
</pre><p>
Note that the code above is "balanced":
at its end, the stack is back to its original configuration.
This is considered good programming practice.





<hr><h3><a name="lua_CFunction"><code>lua_CFunction</code></a></h3>
<pre>typedef int (*lua_CFunction) (lua_State *L);</pre>

<p>
Type for C&nbsp;functions.


<p>
In order to communicate properly with Lua,
a C&nbsp;function must use the following protocol,
which defines the way parameters and results are passed:
a C&nbsp;function receives its arguments from Lua in its stack
in direct order (the first argument is pushed first).
So, when the function starts,
<code>lua_gettop(L)</code> returns the number of arguments received by the function.
The first argument (if any) is at index 1
and its last argument is at index <code>lua_gettop(L)</code>.
To return values to Lua, a C&nbsp;function just pushes them onto the stack,
in direct order (the first result is pushed first),
and returns the number of results.
Any other value in the stack below the results will be properly
discarded by Lua.
Like a Lua function, a C&nbsp;function called by Lua can also return
many results.


<p>
As an example, the following function receives a variable number
of numerical arguments and returns their average and sum:

<pre>
     static int foo (lua_State *L) {
       int n = lua_gettop(L);    /* number of arguments */
       lua_Number sum = 0;
       int i;
       for (i = 1; i &lt;= n; i++) {
         if (!lua_isnumber(L, i)) {
           lua_pushstring(L, "incorrect argument");
           lua_error(L);
         }
         sum += lua_tonumber(L, i);
       }
       lua_pushnumber(L, sum/n);        /* first result */
       lua_pushnumber(L, sum);         /* second result */
       return 2;                   /* number of results */
     }
</pre>




<hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3><p>
<span class="apii">[-0, +0, <em>m</em>]</span>
<pre>int lua_checkstack (lua_State *L, int extra);</pre>

<p>
Ensures that there are at least <code>extra</code> free stack slots in the stack.
It returns false if it cannot grow the stack to that size.
This function never shrinks the stack;
if the stack is already larger than the new size,
it is left unchanged.





<hr><h3><a name="lua_close"><code>lua_close</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>void lua_close (lua_State *L);</pre>

<p>
Destroys all objects in the given Lua state
(calling the corresponding garbage-collection metamethods, if any)
and frees all dynamic memory used by this state.
On several platforms, you may not need to call this function,
because all resources are naturally released when the host program ends.
On the other hand, long-running programs,
such as a daemon or a web server,
might need to release states as soon as they are not needed,
to avoid growing too large.





<hr><h3><a name="lua_concat"><code>lua_concat</code></a></h3><p>
<span class="apii">[-n, +1, <em>e</em>]</span>
<pre>void lua_concat (lua_State *L, int n);</pre>

<p>
Concatenates the <code>n</code> values at the top of the stack,
pops them, and leaves the result at the top.
If <code>n</code>&nbsp;is&nbsp;1, the result is the single value on the stack
(that is, the function does nothing);
if <code>n</code> is 0, the result is the empty string.
Concatenation is performed following the usual semantics of Lua
(see <a href="#2.5.4">&sect;2.5.4</a>).





<hr><h3><a name="lua_cpcall"><code>lua_cpcall</code></a></h3><p>
<span class="apii">[-0, +(0|1), <em>-</em>]</span>
<pre>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</pre>

<p>
Calls the C&nbsp;function <code>func</code> in protected mode.
<code>func</code> starts with only one element in its stack,
a light userdata containing <code>ud</code>.
In case of errors,
<a href="#lua_cpcall"><code>lua_cpcall</code></a> returns the same error codes as <a href="#lua_pcall"><code>lua_pcall</code></a>,
plus the error object on the top of the stack;
otherwise, it returns zero, and does not change the stack.
All values returned by <code>func</code> are discarded.





<hr><h3><a name="lua_createtable"><code>lua_createtable</code></a></h3><p>
<span class="apii">[-0, +1, <em>m</em>]</span>
<pre>void lua_createtable (lua_State *L, int narr, int nrec);</pre>

<p>
Creates a new empty table and pushes it onto the stack.
The new table has space pre-allocated
for <code>narr</code> array elements and <code>nrec</code> non-array elements.
This pre-allocation is useful when you know exactly how many elements
the table will have.
Otherwise you can use the function <a href="#lua_newtable"><code>lua_newtable</code></a>.





<hr><h3><a name="lua_dump"><code>lua_dump</code></a></h3><p>
<span class="apii">[-0, +0, <em>m</em>]</span>
<pre>int lua_dump (lua_State *L, lua_Writer writer, void *data);</pre>

<p>
Dumps a function as a binary chunk.
Receives a Lua function on the top of the stack
and produces a binary chunk that,
if loaded again,
results in a function equivalent to the one dumped.
As it produces parts of the chunk,
<a href="#lua_dump"><code>lua_dump</code></a> calls function <code>writer</code> (see <a href="#lua_Writer"><code>lua_Writer</code></a>)
with the given <code>data</code>
to write them.


<p>
The value returned is the error code returned by the last
call to the writer;
0&nbsp;means no errors.


<p>
This function does not pop the Lua function from the stack.





<hr><h3><a name="lua_equal"><code>lua_equal</code></a></h3><p>
<span class="apii">[-0, +0, <em>e</em>]</span>
<pre>int lua_equal (lua_State *L, int index1, int index2);</pre>

<p>
Returns 1 if the two values in acceptable indices <code>index1</code> and
<code>index2</code> are equal,
following the semantics of the Lua <code>==</code> operator
(that is, may call metamethods).
Otherwise returns&nbsp;0.
Also returns&nbsp;0 if any of the indices is non valid.





<hr><h3><a name="lua_error"><code>lua_error</code></a></h3><p>
<span class="apii">[-1, +0, <em>v</em>]</span>
<pre>int lua_error (lua_State *L);</pre>

<p>
Generates a Lua error.
The error message (which can actually be a Lua value of any type)
must be on the stack top.
This function does a long jump,
and therefore never returns.
(see <a href="#luaL_error"><code>luaL_error</code></a>).





<hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3><p>
<span class="apii">[-0, +0, <em>e</em>]</span>
<pre>int lua_gc (lua_State *L, int what, int data);</pre>

<p>
Controls the garbage collector.


<p>
This function performs several tasks,
according to the value of the parameter <code>what</code>:

<ul>

<li><b><code>LUA_GCSTOP</code>:</b>
stops the garbage collector.
</li>

<li><b><code>LUA_GCRESTART</code>:</b>
restarts the garbage collector.
</li>

<li><b><code>LUA_GCCOLLECT</code>:</b>
performs a full garbage-collection cycle.
</li>

<li><b><code>LUA_GCCOUNT</code>:</b>
returns the current amount of memory (in Kbytes) in use by Lua.
</li>

<li><b><code>LUA_GCCOUNTB</code>:</b>
returns the remainder of dividing the current amount of bytes of
memory in use by Lua by 1024.
</li>

<li><b><code>LUA_GCSTEP</code>:</b>
performs an incremental step of garbage collection.
The step "size" is controlled by <code>data</code>
(larger values mean more steps) in a non-specified way.
If you want to control the step size
you must experimentally tune the value of <code>data</code>.
The function returns 1 if the step finished a
garbage-collection cycle.
</li>

<li><b><code>LUA_GCSETPAUSE</code>:</b>
sets <code>data</code> as the new value
for the <em>pause</em> of the collector (see <a href="#2.10">&sect;2.10</a>).
The function returns the previous value of the pause.
</li>

<li><b><code>LUA_GCSETSTEPMUL</code>:</b>
sets <code>data</code> as the new value for the <em>step multiplier</em> of
the collector (see <a href="#2.10">&sect;2.10</a>).
The function returns the previous value of the step multiplier.
</li>

</ul>




<hr><h3><a name="lua_getallocf"><code>lua_getallocf</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre>

<p>
Returns the memory-allocation function of a given state.
If <code>ud</code> is not <code>NULL</code>, Lua stores in <code>*ud</code> the
opaque pointer passed to <a href="#lua_newstate"><code>lua_newstate</code></a>.





<hr><h3><a name="lua_getfenv"><code>lua_getfenv</code></a></h3><p>
<span class="apii">[-0, +1, <em>-</em>]</span>
<pre>void lua_getfenv (lua_State *L, int index);</pre>

<p>
Pushes onto the stack the environment table of
the value at the given index.





<hr><h3><a name="lua_getfield"><code>lua_getfield</code></a></h3><p>
<span class="apii">[-0, +1, <em>e</em>]</span>
<pre>void lua_getfield (lua_State *L, int index, const char *k);</pre>

<p>
Pushes onto the stack the value <code>t[k]</code>,
where <code>t</code> is the value at the given valid index.
As in Lua, this function may trigger a metamethod
for the "index" event (see <a href="#2.8">&sect;2.8</a>).





<hr><h3><a name="lua_getglobal"><code>lua_getglobal</code></a></h3><p>
<span class="apii">[-0, +1, <em>e</em>]</span>
<pre>void lua_getglobal (lua_State *L, const char *name);</pre>

<p>
Pushes onto the stack the value of the global <code>name</code>.
It is defined as a macro:

<pre>
     #define lua_getglobal(L,s)  lua_getfield(L, LUA_GLOBALSINDEX, s)
</pre>




<hr><h3><a name="lua_getmetatable"><code>lua_getmetatable</code></a></h3><p>
<span class="apii">[-0, +(0|1), <em>-</em>]</span>
<pre>int lua_getmetatable (lua_State *L, int index);</pre>

<p>
Pushes onto the stack the metatable of the value at the given
acceptable index.
If the index is not valid,
or if the value does not have a metatable,
the function returns&nbsp;0 and pushes nothing on the stack.





<hr><h3><a name="lua_gettable"><code>lua_gettable</code></a></h3><p>
<span class="apii">[-1, +1, <em>e</em>]</span>
<pre>void lua_gettable (lua_State *L, int index);</pre>

<p>
Pushes onto the stack the value <code>t[k]</code>,
where <code>t</code> is the value at the given valid index
and <code>k</code> is the value at the top of the stack.


<p>
This function pops the key from the stack
(putting the resulting value in its place).
As in Lua, this function may trigger a metamethod
for the "index" event (see <a href="#2.8">&sect;2.8</a>).





<hr><h3><a name="lua_gettop"><code>lua_gettop</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_gettop (lua_State *L);</pre>

<p>
Returns the index of the top element in the stack.
Because indices start at&nbsp;1,
this result is equal to the number of elements in the stack
(and so 0&nbsp;means an empty stack).





<hr><h3><a name="lua_insert"><code>lua_insert</code></a></h3><p>
<span class="apii">[-1, +1, <em>-</em>]</span>
<pre>void lua_insert (lua_State *L, int index);</pre>

<p>
Moves the top element into the given valid index,
shifting up the elements above this index to open space.
Cannot be called with a pseudo-index,
because a pseudo-index is not an actual stack position.





<hr><h3><a name="lua_Integer"><code>lua_Integer</code></a></h3>
<pre>typedef ptrdiff_t lua_Integer;</pre>

<p>
The type used by the Lua API to represent integral values.


<p>
By default it is a <code>ptrdiff_t</code>,
which is usually the largest signed integral type the machine handles
"comfortably".





<hr><h3><a name="lua_isboolean"><code>lua_isboolean</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isboolean (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index has type boolean,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_iscfunction"><code>lua_iscfunction</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_iscfunction (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a C&nbsp;function,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isfunction"><code>lua_isfunction</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isfunction (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a function
(either C or Lua), and 0&nbsp;otherwise.





<hr><h3><a name="lua_islightuserdata"><code>lua_islightuserdata</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_islightuserdata (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a light userdata,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isnil"><code>lua_isnil</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isnil (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is <b>nil</b>,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isnone"><code>lua_isnone</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isnone (lua_State *L, int index);</pre>

<p>
Returns 1 if the given acceptable index is not valid
(that is, it refers to an element outside the current stack),
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isnoneornil"><code>lua_isnoneornil</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isnoneornil (lua_State *L, int index);</pre>

<p>
Returns 1 if the given acceptable index is not valid
(that is, it refers to an element outside the current stack)
or if the value at this index is <b>nil</b>,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isnumber"><code>lua_isnumber</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isnumber (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a number
or a string convertible to a number,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isstring"><code>lua_isstring</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isstring (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a string
or a number (which is always convertible to a string),
and 0&nbsp;otherwise.





<hr><h3><a name="lua_istable"><code>lua_istable</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_istable (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a table,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isthread"><code>lua_isthread</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isthread (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a thread,
and 0&nbsp;otherwise.





<hr><h3><a name="lua_isuserdata"><code>lua_isuserdata</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>int lua_isuserdata (lua_State *L, int index);</pre>

<p>
Returns 1 if the value at the given acceptable index is a userdata
(either full or light), and 0&nbsp;otherwise.





<hr><h3><a name="lua_lessthan"><code>lua_lessthan</code></a></h3><p>
<span class="apii">[-0, +0, <em>e</em>]</span>
<pre>int lua_lessthan (lua_State *L, int index1, int index2);</pre>

<p>
Returns 1 if the value at acceptable index <code>index1</code> is smaller
than the value at acceptable index <code>index2</code>,
following the semantics of the Lua <code>&lt;</code> operator
(that is, may call metamethods).
Otherwise returns&nbsp;0.
Also returns&nbsp;0 if any of the indices is non valid.





<hr><h3><a name="lua_load"><code>lua_load</code></a></h3><p>
<span class="apii">[-0, +1, <em>-</em>]</span>
<pre>int lua_load (lua_State *L,
              lua_Reader reader,
              void *data,
              const char *chunkname);</pre>

<p>
Loads a Lua chunk.
If there are no errors,
<a href="#lua_load"><code>lua_load</code></a> pushes the compiled chunk as a Lua
function on top of the stack.
Otherwise, it pushes an error message.
The return values of <a href="#lua_load"><code>lua_load</code></a> are:

<ul>

<li><b>0:</b> no errors;</li>

<li><b><a name="pdf-LUA_ERRSYNTAX"><code>LUA_ERRSYNTAX</code></a>:</b>
syntax error during pre-compilation;</li>

<li><b><a href="#pdf-LUA_ERRMEM"><code>LUA_ERRMEM</code></a>:</b>
memory allocation error.</li>

</ul>

<p>
This function only loads a chunk;
it does not run it.


<p>
<a href="#lua_load"><code>lua_load</code></a> automatically detects whether the chunk is text or binary,
and loads it accordingly (see program <code>luac</code>).


<p>
The <a href="#lua_load"><code>lua_load</code></a> function uses a user-supplied <code>reader</code> function
to read the chunk (see <a href="#lua_Reader"><code>lua_Reader</code></a>).
The <code>data</code> argument is an opaque value passed to the reader function.


<p>
The <code>chunkname</code> argument gives a name to the chunk,
which is used for error messages and in debug information (see <a href="#3.8">&sect;3.8</a>).





<hr><h3><a name="lua_newstate"><code>lua_newstate</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>lua_State *lua_newstate (lua_Alloc f, void *ud);</pre>

<p>
Creates a new, independent state.
Returns <code>NULL</code> if cannot create the state
(due to lack of memory).
The argument <code>f</code> is the allocator function;
Lua does all memory allocation for this state through this function.
The second argument, <code>ud</code>, is an opaque pointer that Lua
simply passes to the allocator in every call.





<hr><h3><a name="lua_newtable"><code>lua_newtable</code></a></h3><p>
<span class="apii">[-0, +1, <em>m</em>]</span>
<pre>void lua_newtable (lua_State *L);</pre>

<p>
Creates a new empty table and pushes it onto the stack.
It is equivalent to <code>lua_createtable(L, 0, 0)</code>.





<hr><h3><a name="lua_newthread"><code>lua_newthread</code></a></h3><p>
<span class="apii">[-0, +1, <em>m</em>]</span>
<pre>lua_State *lua_newthread (lua_State *L);</pre>

<p>
Creates a new thread, pushes it on the stack,
and returns a pointer to a <a href="#lua_State"><code>lua_State</code></a> that represents this new thread.
The new state returned by this function shares with the original state
all global objects (such as tables),
but has an independent execution stack.


<p>
There is no explicit function to close or to destroy a thread.
Threads are subject to garbage collection,
like any Lua object.





<hr><h3><a name="lua_newuserdata"><code>lua_newuserdata</code></a></h3><p>
<span class="apii">[-0, +1, <em>m</em>]</span>
<pre>void *lua_newuserdata (lua_State *L, size_t size);</pre>

<p>
This function allocates a new block of memory with the given size,
pushes onto the stack a new full userdata with the block address,
and returns this address.


<p>
Userdata represent C&nbsp;values in Lua.
A <em>full userdata</em> represents a block of memory.
It is an object (like a table):
you must create it, it can have its own metatable,
and you can detect when it is being collected.
A full userdata is only equal to itself (under raw equality).


<p>
When Lua collects a full userdata with a <code>gc</code> metamethod,
Lua calls the metamethod and marks the userdata as finalized.
When this userdata is collected again then
Lua frees its corresponding memory.





<hr><h3><a name="lua_next"><code>lua_next</code></a></h3><p>
<span class="apii">[-1, +(2|0), <em>e</em>]</span>
<pre>int lua_next (lua_State *L, int index);</pre>

<p>
Pops a key from the stack,
and pushes a key-value pair from the table at the given index
(the "next" pair after the given key).
If there are no more elements in the table,
then <a href="#lua_next"><code>lua_next</code></a> returns 0 (and pushes nothing).


<p>
A typical traversal looks like this:

<pre>
     /* table is in the stack at index 't' */
     lua_pushnil(L);  /* first key */
     while (lua_next(L, t) != 0) {
       /* uses 'key' (at index -2) and 'value' (at index -1) */
       printf("%s - %s\n",
              lua_typename(L, lua_type(L, -2)),
              lua_typename(L, lua_type(L, -1)));
       /* removes 'value'; keeps 'key' for next iteration */
       lua_pop(L, 1);
     }
</pre>

<p>
While traversing a table,
do not call <a href="#lua_tolstring"><code>lua_tolstring</code></a> directly on a key,
unless you know that the key is actually a string.
Recall that <a href="#lua_tolstring"><code>lua_tolstring</code></a> <em>changes</em>
the value at the given index;
this confuses the next call to <a href="#lua_next"><code>lua_next</code></a>.





<hr><h3><a name="lua_Number"><code>lua_Number</code></a></h3>
<pre>typedef double lua_Number;</pre>

<p>
The type of numbers in Lua.
By default, it is double, but that can be changed in <code>luaconf.h</code>.


<p>
Through the configuration file you can change
Lua to operate with another type for numbers (e.g., float or long).





<hr><h3><a name="lua_objlen"><code>lua_objlen</code></a></h3><p>
<span class="apii">[-0, +0, <em>-</em>]</span>
<pre>size_t lua_objlen (lua_State *L, int index);</pre>

<p>
Returns the "length" of the value at the given acceptable index:
for strings, this is the string length;
for tables, this is the result of the length operator ('<code>#</code>');
for userdata, this is the size of the block of memory allocated
for the userdata;
for other values, it is&nbsp;0.





<hr><h3><a name="lua_pcall"><code>lua_pcall</code></a></h3><p>
<span class="apii">[-(nargs + 1), +(nresults|1), <em>-</em>]</span>
<pre>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</pre>

<p>
Calls a function in protected mode.


<p>
Both <code>nargs</code> and <code>nresults</code> have the same meaning as
in <a href="#lua_call"><code>lua_call</code></a>.
If there are no errors during the call,
<a href="#lua_pcall"><code>lua_pcall</code></a> behaves exactly like <a href="#lua_call"><code>lua_call</code></a>.
However, if there is any error,
<a href="#lua_pcall"><code>lua_pcall</code></a> catches it,
pushes a single value on the stack (the error message),
and returns an error code.
Like <a href="#lua_call"><code>lua_call</code></a>,
<a href="#lua_pcall"><code>lua_pcall</code></a> always removes the function
and its arguments from the stack.


<p>
If <code>errfunc</code> is 0,
then the error message returned on the stack
is exactly the original error message.
Otherwise, <code>errfunc</code> is the stack index of an
<em>error handler function</em>.
(In the current implementation, this index cannot be a pseudo-index.)
In case of runtime errors,
this function will be called with the error message
and its return value will be the message returned on the stack by <a href="#lua_pcall"><code>lua_pcall</code></a>.


<p>
Typically, the error handler function is used to add more debug
information to the error message, such as a stack traceback.
Such information cannot be gathered after the return of <a href="#lua_pcall"><code>lua_pcall</code></a>,
since by then the stack has unwound.


<p>
The <a href="#lua_pcall"><code>lua_pcall</code></a> function returns 0 in case of success
or one of the following error codes
(defined in <code>lua.h</code>):

<ul>

<li><b><a name="pdf-LUA_ERRRUN"><code>LUA_ERRRUN</code></a>:</b>
a runtime error.
</li>

<li><b><a name="pdf-LUA_ERRMEM"><code>LUA_ERRMEM</code></a>:</b>
memory allocation error.
For such errors, Lua does not call the error handler function.
</li>

<li><b><a name="pdf-LUA_ERRERR"><code>LUA_ERRERR</code></a>:</b>
error while running the error handler function.
</li>

</ul>




<hr><h3><a name="lua_pop"><code>lua_pop</code></a></h3><p>
<span class="apii">[-n, +0, <em>-</em>]</span>
<pre>void lua_pop (lua_State *L, int n);</pre>

<p>
Pops <code>n</code> elements from the stack.





<hr><h3><a name="lua_pushboolean"><code>lua_pushboolean</code></a></h3><p>
<span class="apii">[-0, +1, <em>-</em>]</span>
<pre>void lua_pushboolean (lua_State *L, int b);</pre>

<p>
Pushes a boolean value with value <code>b</code> onto the stack.





<hr><h3><a name="lua_pushcclosure"><code>lua_pushcclosure</code></a></h3><p>
<span class="apii">[-n, +1, <em>m</em>]</span>
<pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre>

<p>
Pushes 
Download .txt
gitextract_gz0j2dmj/

├── .gitignore
├── .hgignore
├── AUTHORS
├── CMakeLists.txt
├── COPYRIGHT
├── ChangeLog
├── HISTORY
├── INSTALL
├── README
├── README.llvm-lua
├── TODO
├── cmake/
│   ├── CustomMacros.cmake
│   └── FindLLVM.cmake
├── cmake_uninstall.cmake.in
├── doc/
│   ├── contents.html
│   ├── lua.1
│   ├── lua.css
│   ├── lua.html
│   ├── luac.1
│   ├── luac.html
│   ├── manual.css
│   ├── manual.html
│   └── readme.html
├── etc/
│   ├── README
│   ├── all.c
│   ├── embed_jit.c
│   ├── embed_jit.cpp
│   ├── lua.hpp
│   ├── lua.pc
│   ├── luavs.bat
│   ├── min.c
│   ├── noparser.c
│   └── strict.lua
├── gen_changelog.sh
├── llvm-lua/
│   ├── CMakeLists.txt
│   ├── COPYRIGHT.llvm-lua
│   ├── LLVMCompiler.cpp
│   ├── LLVMCompiler.h
│   ├── LLVMDumper.cpp
│   ├── LLVMDumper.h
│   ├── TODO
│   ├── bin2c.c
│   ├── compile_all.sh
│   ├── hook_parser.c
│   ├── llvm-lua.cpp
│   ├── llvm-luac.cpp
│   ├── llvm_compiler.cpp
│   ├── llvm_compiler.h
│   ├── llvm_compiler_private.h
│   ├── llvm_dumper.cpp
│   ├── llvm_dumper.h
│   ├── llvm_lmathlib.c
│   ├── llvm_lua_config.h.in
│   ├── load_embedded_bc.cpp
│   ├── load_jit_proto.c
│   ├── load_jit_proto.h
│   ├── load_liblua_main.cpp
│   ├── load_liblua_main.h
│   ├── load_vm_ops.cpp
│   ├── load_vm_ops.h
│   ├── lua-compiler.in
│   ├── lua-cross-compiler.in
│   ├── lua_compiler.c
│   ├── lua_compiler.h
│   ├── lua_core.c
│   ├── lua_core.h
│   ├── lua_interpreter.c
│   ├── lua_interpreter.h
│   ├── lua_main.c
│   ├── lua_normal.c
│   ├── lua_vm_ops.c
│   ├── lua_vm_ops.h
│   ├── lua_vm_ops_static.c
│   ├── no_jit.c
│   ├── run_tests.sh
│   └── tests/
│       ├── NOTES
│       ├── add.lua
│       ├── arg_test.lua
│       ├── big_table.lua
│       ├── coroutine.lua
│       ├── dump.lua
│       ├── for.lua
│       ├── hash2.lua
│       ├── loadk.lua
│       ├── local_nil.lua
│       ├── loops.lua
│       ├── lua_tail.lua
│       ├── nestedloop.lua
│       ├── nestedloop2.lua
│       ├── nums.lua
│       ├── scimark_loop.lua
│       ├── scimark_rand.lua
│       ├── stress_for.lua
│       ├── test.lua
│       ├── test2.lua
│       ├── test3.lua
│       ├── test4.lua
│       ├── test_lineerror.lua
│       ├── test_math.lua
│       ├── test_tail.lua
│       ├── test_tail_nil_multret.lua
│       └── test_varg_tail2.lua
├── src/
│   ├── lapi.c
│   ├── lapi.h
│   ├── lauxlib.c
│   ├── lauxlib.h
│   ├── lbaselib.c
│   ├── lcoco.c
│   ├── lcoco.h
│   ├── lcode.c
│   ├── lcode.h
│   ├── ldblib.c
│   ├── ldebug.c
│   ├── ldebug.h
│   ├── ldo.c
│   ├── ldo.h
│   ├── ldump.c
│   ├── lfunc.c
│   ├── lfunc.h
│   ├── lgc.c
│   ├── lgc.h
│   ├── linit.c
│   ├── liolib.c
│   ├── llex.c
│   ├── llex.h
│   ├── llimits.h
│   ├── lmathlib.c
│   ├── lmem.c
│   ├── lmem.h
│   ├── loadlib.c
│   ├── lobject.c
│   ├── lobject.h
│   ├── lopcodes.c
│   ├── lopcodes.h
│   ├── loslib.c
│   ├── lparser.c
│   ├── lparser.h
│   ├── lstate.c
│   ├── lstate.h
│   ├── lstring.c
│   ├── lstring.h
│   ├── lstrlib.c
│   ├── ltable.c
│   ├── ltable.h
│   ├── ltablib.c
│   ├── ltm.c
│   ├── ltm.h
│   ├── lua.c
│   ├── lua.h
│   ├── luac.c
│   ├── luaconf.h
│   ├── lualib.h
│   ├── lundump.c
│   ├── lundump.h
│   ├── lvm.c
│   ├── lvm.h
│   ├── lzio.c
│   ├── lzio.h
│   └── print.c
├── test/
│   ├── README
│   ├── bisect.lua
│   ├── cf.lua
│   ├── echo.lua
│   ├── env.lua
│   ├── factorial.lua
│   ├── fib.lua
│   ├── fibfor.lua
│   ├── globals.lua
│   ├── hello.lua
│   ├── life.lua
│   ├── luac.lua
│   ├── printf.lua
│   ├── readonly.lua
│   ├── sieve.lua
│   ├── sort.lua
│   ├── table.lua
│   ├── trace-calls.lua
│   ├── trace-globals.lua
│   └── xd.lua
└── tools/
    └── hg_import_split.lua
Download .txt
SYMBOL INDEX (990 symbols across 66 files)

FILE: etc/embed_jit.c
  function print (line 12) | static int print(lua_State *L)
  function main (line 32) | int main(int argc, char **argv)

FILE: etc/embed_jit.cpp
  function print (line 14) | static int print(lua_State *L)
  function main (line 34) | int main(int argc, char **argv)

FILE: etc/min.c
  function print (line 12) | static int print(lua_State *L)
  function main (line 32) | int main(void)

FILE: etc/noparser.c
  function LUAI_FUNC (line 21) | LUAI_FUNC void luaX_init (lua_State *L) {
  function LUAI_FUNC (line 25) | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const...
  function LUAI_FUNC (line 37) | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, voi...

FILE: llvm-lua/LLVMCompiler.cpp
  function print_opcode_stats (line 415) | void print_opcode_stats(int *stats, const char *stats_name) {

FILE: llvm-lua/LLVMCompiler.h
  function namespace (line 46) | namespace llvm {
  function class (line 52) | class LLVMCompiler {
  function class (line 67) | class OPValues {
  function setStripCode (line 150) | void setStripCode(bool strip) {

FILE: llvm-lua/LLVMDumper.h
  function namespace (line 41) | namespace llvm {
  function class (line 52) | class LLVMDumper {

FILE: llvm-lua/bin2c.c
  function myfgetc (line 33) | int myfgetc(FILE *f)
  function process (line 44) | void process(const char *ifname, const char *ofname)
  function usage (line 94) | void usage(void)
  function main (line 100) | int main(int argc, char **argv)

FILE: llvm-lua/hook_parser.c
  function llvm_precall_lua (line 19) | int llvm_precall_lua (lua_State *L, StkId func, int nresults) {
  function llvm_f_parser (line 31) | static void llvm_f_parser (lua_State *L, void *ud) {
  function luaD_protectedparser (line 52) | int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
  function llvm_precall_jit (line 62) | int llvm_precall_jit (lua_State *L, StkId func, int nresults) {
  function llvm_precall_jit_vararg (line 95) | int llvm_precall_jit_vararg (lua_State *L, StkId func, int nresults) {
  function llvm_precall_lua (line 129) | int llvm_precall_lua (lua_State *L, StkId func, int nresults) {

FILE: llvm-lua/llvm-lua.cpp
  function print_version (line 69) | void print_version() {
  function main (line 78) | int main(int argc, char ** argv) {

FILE: llvm-lua/llvm-luac.cpp
  function print_version (line 93) | void print_version() {
  function main (line 104) | int main(int argc, char ** argv) {

FILE: llvm-lua/llvm_compiler.cpp
  function llvm_compiler_main (line 39) | int llvm_compiler_main(int useJIT) {
  function LLVMCompiler (line 44) | LLVMCompiler *llvm_get_compiler(lua_State *L) {
  function llvm_new_compiler (line 49) | void llvm_new_compiler(lua_State *L) {
  function llvm_free_compiler (line 59) | void llvm_free_compiler(lua_State *L) {
  function llvm_compiler_compile (line 66) | void llvm_compiler_compile(lua_State *L, Proto *p) {
  function llvm_compiler_compile_all (line 74) | void llvm_compiler_compile_all(lua_State *L, Proto *p) {
  function llvm_compiler_free (line 82) | void llvm_compiler_free(lua_State *L, Proto *p) {

FILE: llvm-lua/llvm_dumper.cpp
  function llvm_dumper_dump (line 33) | void llvm_dumper_dump(const char *output, lua_State *L, Proto *p, int st...

FILE: llvm-lua/llvm_lmathlib.c
  function math_abs (line 63) | static int math_abs (lua_State *L) {
  function math_sin (line 70) | static int math_sin (lua_State *L) {
  function math_sinh (line 77) | static int math_sinh (lua_State *L) {
  function math_cos (line 84) | static int math_cos (lua_State *L) {
  function math_cosh (line 91) | static int math_cosh (lua_State *L) {
  function math_tan (line 98) | static int math_tan (lua_State *L) {
  function math_tanh (line 105) | static int math_tanh (lua_State *L) {
  function math_asin (line 112) | static int math_asin (lua_State *L) {
  function math_acos (line 119) | static int math_acos (lua_State *L) {
  function math_atan (line 126) | static int math_atan (lua_State *L) {
  function math_atan2 (line 133) | static int math_atan2 (lua_State *L) {
  function math_ceil (line 140) | static int math_ceil (lua_State *L) {
  function math_floor (line 147) | static int math_floor (lua_State *L) {
  function math_fmod (line 154) | static int math_fmod (lua_State *L) {
  function math_modf (line 161) | static int math_modf (lua_State *L) {
  function math_sqrt (line 169) | static int math_sqrt (lua_State *L) {
  function math_pow (line 176) | static int math_pow (lua_State *L) {
  function math_log (line 183) | static int math_log (lua_State *L) {
  function math_log10 (line 190) | static int math_log10 (lua_State *L) {
  function math_exp (line 197) | static int math_exp (lua_State *L) {
  function math_deg (line 204) | static int math_deg (lua_State *L) {
  function math_rad (line 212) | static int math_rad (lua_State *L) {
  function math_frexp (line 220) | static int math_frexp (lua_State *L) {
  function math_ldexp (line 227) | static int math_ldexp (lua_State *L) {
  function math_min (line 235) | static int math_min (lua_State *L) {
  function math_max (line 249) | static int math_max (lua_State *L) {
  function math_random (line 263) | static int math_random (lua_State *L) {
  function math_randomseed (line 291) | static int math_randomseed (lua_State *L) {
  function LUALIB_API (line 333) | LUALIB_API int luaopen_math (lua_State *L) {

FILE: llvm-lua/load_jit_proto.c
  function Proto (line 48) | Proto *load_jit_proto(lua_State *L, jit_proto *p) {
  function LUALIB_API (line 131) | LUALIB_API int load_compiled_protos(lua_State *L, jit_proto *p) {
  function LUALIB_API (line 155) | LUALIB_API int load_compiled_module(lua_State *L, jit_proto *p) {

FILE: llvm-lua/load_jit_proto.h
  type constant_value (line 42) | typedef union constant_value {
  type constant_type (line 49) | typedef struct constant_type {
  type jit_LocVar (line 56) | typedef struct jit_LocVar {
  type jit_proto (line 63) | typedef struct jit_proto jit_proto;
  type jit_proto (line 64) | struct jit_proto {

FILE: llvm-lua/lua_compiler.c
  function fatal (line 56) | static void fatal(const char* message) {
  function cannot (line 61) | static void cannot(const char* what) {
  function usage (line 66) | static void usage(const char* message) {
  function doargs (line 89) | static int doargs(int argc, char* argv[]) {
  function Proto (line 137) | static Proto* combine(lua_State* L, int scripts) {
  function writer (line 200) | static int writer(lua_State* L, const void* p, size_t size, void* u) {
  type Smain (line 205) | struct Smain {
  function pmain (line 210) | static int pmain(lua_State* L) {
  function luac_main (line 287) | int luac_main(int argc, char* argv[]) {

FILE: llvm-lua/lua_core.c
  function llvm_newproto (line 77) | void llvm_newproto (lua_State *L, Proto *f) {
  function llvm_freeproto (line 83) | void llvm_freeproto (lua_State *L, Proto *f) {

FILE: llvm-lua/lua_main.c
  function lstop (line 36) | static void lstop (lua_State *L, lua_Debug *ar) {
  function laction (line 43) | static void laction (int i) {
  function l_message (line 50) | static void l_message (const char *pname, const char *msg) {
  function report (line 57) | static int report (lua_State *L, int status) {
  function traceback (line 68) | static int traceback (lua_State *L) {
  function docall (line 88) | static int docall (lua_State *L, int narg, int clear) {
  function getargs (line 103) | static int getargs (lua_State *L, int argc, char **argv) {
  function dofile (line 117) | static int dofile (lua_State *L, const char *name) {
  function dostring (line 123) | static int dostring (lua_State *L, const char *s, const char *name) {
  function handle_script (line 128) | static int handle_script (lua_State *L, int argc, char **argv) {
  function handle_luainit (line 146) | static int handle_luainit (lua_State *L) {
  type Smain (line 156) | struct Smain {
  function pmain (line 163) | static int pmain (lua_State *L) {
  function main (line 179) | int main (int argc, char **argv) {

FILE: llvm-lua/lua_vm_ops.c
  function vm_OP_MOVE (line 31) | void vm_OP_MOVE(lua_State *L, int a, int b) {
  function vm_OP_LOADK (line 37) | void vm_OP_LOADK(lua_State *L, TValue *k, int a, int bx) {
  function vm_OP_LOADK_N (line 43) | void vm_OP_LOADK_N(lua_State *L, int a, lua_Number nb) {
  function vm_OP_LOADBOOL (line 49) | void vm_OP_LOADBOOL(lua_State *L, int a, int b, int c) {
  function vm_OP_LOADNIL (line 55) | void vm_OP_LOADNIL(lua_State *L, int a, int b) {
  function vm_OP_GETUPVAL (line 64) | void vm_OP_GETUPVAL(lua_State *L, LClosure *cl, int a, int b) {
  function vm_OP_GETGLOBAL (line 70) | void vm_OP_GETGLOBAL(lua_State *L, TValue *k, LClosure *cl, int a, int b...
  function vm_OP_GETTABLE (line 80) | void vm_OP_GETTABLE(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_SETGLOBAL (line 86) | void vm_OP_SETGLOBAL(lua_State *L, TValue *k, LClosure *cl, int a, int b...
  function vm_OP_SETUPVAL (line 95) | void vm_OP_SETUPVAL(lua_State *L, LClosure *cl, int a, int b) {
  function vm_OP_SETTABLE (line 103) | void vm_OP_SETTABLE(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_NEWTABLE (line 109) | void vm_OP_NEWTABLE(lua_State *L, int a, int b_fb2int, int c_fb2int) {
  function vm_OP_SELF (line 116) | void vm_OP_SELF(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_ADD (line 124) | void vm_OP_ADD(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_ADD_NC (line 129) | void vm_OP_ADD_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_SUB (line 134) | void vm_OP_SUB(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_SUB_NC (line 139) | void vm_OP_SUB_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_MUL (line 144) | void vm_OP_MUL(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_MUL_NC (line 149) | void vm_OP_MUL_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_DIV (line 154) | void vm_OP_DIV(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_DIV_NC (line 159) | void vm_OP_DIV_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_MOD (line 164) | void vm_OP_MOD(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_MOD_NC (line 169) | void vm_OP_MOD_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_POW (line 174) | void vm_OP_POW(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_POW_NC (line 179) | void vm_OP_POW_NC(lua_State *L, TValue *k, int a, int b, lua_Number nc, ...
  function vm_OP_UNM (line 184) | void vm_OP_UNM(lua_State *L, int a, int b) {
  function vm_OP_NOT (line 197) | void vm_OP_NOT(lua_State *L, int a, int b) {
  function vm_OP_LEN (line 204) | void vm_OP_LEN(lua_State *L, int a, int b) {
  function vm_OP_CONCAT (line 225) | void vm_OP_CONCAT(lua_State *L, int a, int b, int c) {
  function vm_OP_JMP (line 232) | void vm_OP_JMP(lua_State *L, int sbx) {
  function vm_OP_EQ (line 236) | int vm_OP_EQ(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_EQ_NC (line 247) | int vm_OP_EQ_NC(lua_State *L, TValue *k, int b, lua_Number nc) {
  function vm_OP_NOT_EQ_NC (line 260) | int vm_OP_NOT_EQ_NC(lua_State *L, TValue *k, int b, lua_Number nc) {
  function vm_OP_LT (line 273) | int vm_OP_LT(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_LE (line 282) | int vm_OP_LE(lua_State *L, TValue *k, int a, int b, int c) {
  function vm_OP_TEST (line 291) | int vm_OP_TEST(lua_State *L, int a, int c) {
  function vm_OP_TESTSET (line 300) | int vm_OP_TESTSET(lua_State *L, int a, int b, int c) {
  function vm_OP_FORPREP (line 319) | void vm_OP_FORPREP(lua_State *L, int a, int sbx) {
  function vm_OP_FORPREP_no_sub (line 336) | void vm_OP_FORPREP_no_sub(lua_State *L, int a, int sbx) {
  function vm_OP_FORPREP_M_N_N (line 354) | void vm_OP_FORPREP_M_N_N(lua_State *L, int a, int sbx, lua_Number limit,...
  function vm_OP_FORPREP_N_M_N (line 368) | void vm_OP_FORPREP_N_M_N(lua_State *L, int a, int sbx, lua_Number init, ...
  function vm_OP_FORPREP_N_N_N (line 382) | void vm_OP_FORPREP_N_N_N(lua_State *L, int a, int sbx, lua_Number init, ...
  function vm_OP_FORLOOP (line 386) | int vm_OP_FORLOOP(lua_State *L, int a, int sbx) {
  function vm_OP_FORLOOP_N_N (line 401) | int vm_OP_FORLOOP_N_N(lua_State *L, int a, int sbx, lua_Number limit, lu...
  function vm_OP_FORLOOP_N_N_N (line 413) | int vm_OP_FORLOOP_N_N_N(lua_State *L, int a, int sbx, lua_Number idx, lu...
  function vm_OP_FORLOOP_up (line 422) | int vm_OP_FORLOOP_up(lua_State *L, int a, int sbx, lua_Number idx, lua_N...
  function vm_OP_FORLOOP_down (line 430) | int vm_OP_FORLOOP_down(lua_State *L, int a, int sbx, lua_Number idx, lua...
  function vm_OP_FORLOOP_long_up (line 438) | int vm_OP_FORLOOP_long_up(lua_State *L, int a, int sbx, lua_Long idx, lu...
  function vm_OP_FORLOOP_long_down (line 446) | int vm_OP_FORLOOP_long_down(lua_State *L, int a, int sbx, lua_Long idx, ...
  function vm_OP_CLOSE (line 454) | void vm_OP_CLOSE(lua_State *L, int a) {
  function LClosure (line 458) | LClosure *vm_get_current_closure(lua_State *L) {
  function TValue (line 462) | TValue *vm_get_current_constants(LClosure *cl) {
  function lua_Number (line 466) | lua_Number vm_get_number(lua_State *L, int idx) {
  function vm_set_number (line 470) | void vm_set_number(lua_State *L, int idx, lua_Number num) {
  function lua_Long (line 474) | lua_Long vm_get_long(lua_State *L, int idx) {
  function vm_set_long (line 478) | void vm_set_long(lua_State *L, int idx, lua_Long num) {

FILE: llvm-lua/lua_vm_ops.h
  type func_state (line 12) | typedef struct {
  type lua_Long (line 18) | typedef long lua_Long;
  type lua_Long (line 20) | typedef long long lua_Long;
  type hint_t (line 23) | typedef unsigned int hint_t;
  type val_t (line 39) | typedef enum {
  type vm_func_info (line 65) | typedef struct {

FILE: llvm-lua/lua_vm_ops_static.c
  function vm_count_OP (line 211) | void vm_count_OP(const Instruction i) {
  function vm_print_OP (line 215) | void vm_print_OP(lua_State *L, LClosure *cl, const Instruction i, int pc...
  function vm_next_OP (line 234) | void vm_next_OP(lua_State *L, LClosure *cl, int pc_offset) {
  function vm_OP_CALL (line 257) | int vm_OP_CALL(lua_State *L, int a, int b, int c) {
  function vm_OP_RETURN (line 283) | int vm_OP_RETURN(lua_State *L, int a, int b) {
  function vm_OP_TAILCALL (line 292) | int vm_OP_TAILCALL(lua_State *L, int a, int b) {
  function vm_OP_FORPREP_slow (line 348) | void vm_OP_FORPREP_slow(lua_State *L, int a, int sbx) {
  function vm_OP_TFORLOOP (line 363) | int vm_OP_TFORLOOP(lua_State *L, int a, int c) {
  function vm_OP_SETLIST (line 382) | void vm_OP_SETLIST(lua_State *L, int a, int b, int c) {
  function vm_OP_CLOSURE (line 405) | void vm_OP_CLOSURE(lua_State *L, LClosure *cl, int a, int bx, int pseudo...
  function vm_OP_VARARG (line 432) | void vm_OP_VARARG(lua_State *L, LClosure *cl, int a, int b) {
  function is_mini_vm_op (line 455) | int is_mini_vm_op(int opcode) {
  function vm_op_hint_locals (line 473) | void vm_op_hint_locals(char *locals, int stacksize, TValue *k, const Ins...
  function vm_mini_vm (line 613) | void vm_mini_vm(lua_State *L, LClosure *cl, int count, int pseudo_ops_of...

FILE: llvm-lua/no_jit.c
  function llvm_new_compiler (line 50) | void llvm_new_compiler(lua_State *L) {UNUSED(L);}
  function llvm_free_compiler (line 51) | void llvm_free_compiler(lua_State *L) {UNUSED(L);}
  function llvm_compiler_compile (line 52) | void llvm_compiler_compile(lua_State *L, Proto *p) {UNUSED(L);UNUSED(p);}
  function llvm_compiler_compile_all (line 53) | void llvm_compiler_compile_all(lua_State *L, Proto *p) {UNUSED(L);UNUSED...
  function llvm_compiler_free (line 54) | void llvm_compiler_free(lua_State *L, Proto *p) {UNUSED(L);UNUSED(p);}
  function llvm_dumper_dump (line 56) | void llvm_dumper_dump(const char *output, lua_State *L, Proto *p, int st...

FILE: src/lapi.c
  function TValue (line 49) | static TValue *index2adr (lua_State *L, int idx) {
  function Table (line 79) | static Table *getcurrenv (lua_State *L) {
  function luaA_pushobject (line 89) | void luaA_pushobject (lua_State *L, const TValue *o) {
  function LUA_API (line 95) | LUA_API int lua_checkstack (lua_State *L, int size) {
  function LUA_API (line 110) | LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
  function LUA_API (line 125) | LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
  function LUA_API (line 135) | LUA_API lua_State *lua_newthread (lua_State *L) {
  function LUA_API (line 154) | LUA_API int lua_gettop (lua_State *L) {
  function LUA_API (line 159) | LUA_API void lua_settop (lua_State *L, int idx) {
  function LUA_API (line 175) | LUA_API void lua_remove (lua_State *L, int idx) {
  function LUA_API (line 186) | LUA_API void lua_insert (lua_State *L, int idx) {
  function LUA_API (line 198) | LUA_API void lua_replace (lua_State *L, int idx) {
  function LUA_API (line 223) | LUA_API void lua_pushvalue (lua_State *L, int idx) {
  function LUA_API (line 237) | LUA_API int lua_type (lua_State *L, int idx) {
  function LUA_API (line 243) | LUA_API const char *lua_typename (lua_State *L, int t) {
  function LUA_API (line 249) | LUA_API int lua_iscfunction (lua_State *L, int idx) {
  function LUA_API (line 255) | LUA_API int lua_isnumber (lua_State *L, int idx) {
  function LUA_API (line 262) | LUA_API int lua_isstring (lua_State *L, int idx) {
  function LUA_API (line 268) | LUA_API int lua_isuserdata (lua_State *L, int idx) {
  function LUA_API (line 274) | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
  function LUA_API (line 282) | LUA_API int lua_equal (lua_State *L, int index1, int index2) {
  function LUA_API (line 294) | LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
  function LUA_API (line 308) | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
  function LUA_API (line 318) | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) {
  function LUA_API (line 332) | LUA_API int lua_toboolean (lua_State *L, int idx) {
  function LUA_API (line 338) | LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
  function LUA_API (line 356) | LUA_API size_t lua_objlen (lua_State *L, int idx) {
  function LUA_API (line 374) | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
  function LUA_API (line 380) | LUA_API void *lua_touserdata (lua_State *L, int idx) {
  function LUA_API (line 390) | LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
  function LUA_API (line 396) | LUA_API const void *lua_topointer (lua_State *L, int idx) {
  function LUA_API (line 416) | LUA_API void lua_pushnil (lua_State *L) {
  function LUA_API (line 424) | LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
  function LUA_API (line 432) | LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
  function LUA_API (line 440) | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
  function LUA_API (line 449) | LUA_API void lua_pushstring (lua_State *L, const char *s) {
  function LUA_API (line 457) | LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
  function LUA_API (line 468) | LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
  function LUA_API (line 481) | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
  function LUA_API (line 498) | LUA_API void lua_pushboolean (lua_State *L, int b) {
  function LUA_API (line 506) | LUA_API void lua_pushlightuserdata (lua_State *L, const void *p) {
  function LUA_API (line 516) | LUA_API int lua_pushthread (lua_State *L) {
  function LUA_API (line 531) | LUA_API void lua_gettable (lua_State *L, int idx) {
  function LUA_API (line 541) | LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
  function LUA_API (line 556) | LUA_API void lua_rawget (lua_State *L, int idx) {
  function LUA_API (line 566) | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
  function LUA_API (line 577) | LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
  function LUA_API (line 586) | LUA_API int lua_getmetatable (lua_State *L, int objindex) {
  function LUA_API (line 615) | LUA_API void lua_getfenv (lua_State *L, int idx) {
  function LUA_API (line 644) | LUA_API void lua_settable (lua_State *L, int idx) {
  function LUA_API (line 656) | LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
  function LUA_API (line 670) | LUA_API void lua_rawset (lua_State *L, int idx) {
  function LUA_API (line 685) | LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
  function LUA_API (line 700) | LUA_API int lua_setmetatable (lua_State *L, int objindex) {
  function LUA_API (line 737) | LUA_API int lua_setfenv (lua_State *L, int idx) {
  function LUA_API (line 779) | LUA_API void lua_call (lua_State *L, int nargs, int nresults) {
  type CallS (line 795) | struct CallS {  /* data to `f_call' */
  function f_call (line 801) | static void f_call (lua_State *L, void *ud) {
  function LUA_API (line 808) | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfun...
  type CCallS (line 834) | struct CCallS {  /* data to `f_Ccall' */
  function f_Ccall (line 840) | static void f_Ccall (lua_State *L, void *ud) {
  function LUA_API (line 853) | LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) {
  function LUA_API (line 865) | LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
  function LUA_API (line 878) | LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
  function LUA_API (line 893) | LUA_API int  lua_status (lua_State *L) {
  function LUA_API (line 902) | LUA_API int lua_gc (lua_State *L, int what, int data) {
  function LUA_API (line 989) | LUA_API int lua_error (lua_State *L) {
  function LUA_API (line 998) | LUA_API int lua_next (lua_State *L, int idx) {
  function LUA_API (line 1015) | LUA_API void lua_concat (lua_State *L, int n) {
  function LUA_API (line 1032) | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
  function LUA_API (line 1042) | LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
  function LUA_API (line 1050) | LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
  function LUA_API (line 1082) | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
  function LUA_API (line 1096) | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {

FILE: src/lauxlib.c
  function LUALIB_API (line 47) | LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extram...
  function LUALIB_API (line 65) | LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
  function tag_error (line 72) | static void tag_error (lua_State *L, int narg, int tag) {
  function LUALIB_API (line 77) | LUALIB_API void luaL_where (lua_State *L, int level) {
  function LUALIB_API (line 90) | LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
  function LUALIB_API (line 103) | LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
  function LUALIB_API (line 116) | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
  function LUALIB_API (line 128) | LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tnam...
  function LUALIB_API (line 144) | LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *me...
  function LUALIB_API (line 150) | LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
  function LUALIB_API (line 156) | LUALIB_API void luaL_checkany (lua_State *L, int narg) {
  function LUALIB_API (line 162) | LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t...
  function LUALIB_API (line 169) | LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
  function LUALIB_API (line 180) | LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
  function LUALIB_API (line 188) | LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number...
  function LUALIB_API (line 193) | LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
  function LUALIB_API (line 201) | LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
  function LUALIB_API (line 207) | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *eve...
  function LUALIB_API (line 223) | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
  function LUALIB_API (line 233) | LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
  function libsize (line 239) | static int libsize (const luaL_Reg *l) {
  function LUALIB_API (line 246) | LUALIB_API void luaI_openlib (lua_State *L, const char *libname,
  function LUALIB_API (line 275) | LUALIB_API void (luaL_register3) (lua_State *L, const char *libname,
  function libsize3 (line 281) | static int libsize3 (const luaL_Reg3 *l) {
  function LUALIB_API (line 288) | LUALIB_API void (luaI_openlib3) (lua_State *L, const char *libname,
  function checkint (line 330) | static int checkint (lua_State *L, int topop) {
  function getsizes (line 337) | static void getsizes (lua_State *L) {
  function LUALIB_API (line 352) | LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
  function LUALIB_API (line 371) | LUALIB_API int luaL_getn (lua_State *L, int t) {
  function LUALIB_API (line 390) | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const cha...
  function LUALIB_API (line 407) | LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
  function emptybuffer (line 448) | static int emptybuffer (luaL_Buffer *B) {
  function adjuststack (line 460) | static void adjuststack (luaL_Buffer *B) {
  function LUALIB_API (line 479) | LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
  function LUALIB_API (line 486) | LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
  function LUALIB_API (line 492) | LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
  function LUALIB_API (line 497) | LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
  function LUALIB_API (line 504) | LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
  function LUALIB_API (line 522) | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
  function LUALIB_API (line 531) | LUALIB_API int luaL_ref (lua_State *L, int t) {
  function LUALIB_API (line 554) | LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
  type LoadF (line 572) | typedef struct LoadF {
  function errfile (line 593) | static int errfile (lua_State *L, const char *what, int fnameindex) {
  function LUALIB_API (line 602) | LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
  type LoadS (line 643) | typedef struct LoadS {
  function LUALIB_API (line 659) | LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t s...
  function LUALIB_API (line 668) | LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {
  function l_check_memlimit (line 677) | static int l_check_memlimit(lua_State *L, size_t needbytes) {
  function panic (line 715) | static int panic (lua_State *L) {
  function LUALIB_API (line 723) | LUALIB_API lua_State *luaL_newstate (void) {

FILE: src/lauxlib.h
  type luaL_Reg (line 35) | typedef struct luaL_Reg {
  type luaL_Reg3 (line 40) | typedef struct luaL_Reg3 {
  type luaL_Buffer (line 138) | typedef struct luaL_Buffer {

FILE: src/lbaselib.c
  function luaB_print (line 34) | static int luaB_print (lua_State *L) {
  function luaB_tonumber (line 56) | static int luaB_tonumber (lua_State *L) {
  function luaB_error (line 84) | static int luaB_error (lua_State *L) {
  function luaB_getmetatable (line 96) | static int luaB_getmetatable (lua_State *L) {
  function luaB_setmetatable (line 107) | static int luaB_setmetatable (lua_State *L) {
  function getfunc (line 120) | static void getfunc (lua_State *L, int opt) {
  function luaB_getfenv (line 136) | static int luaB_getfenv (lua_State *L) {
  function luaB_setfenv (line 146) | static int luaB_setfenv (lua_State *L) {
  function luaB_rawequal (line 164) | static int luaB_rawequal (lua_State *L) {
  function luaB_rawget (line 172) | static int luaB_rawget (lua_State *L) {
  function luaB_rawset (line 180) | static int luaB_rawset (lua_State *L) {
  function luaB_gcinfo (line 190) | static int luaB_gcinfo (lua_State *L) {
  function luaB_collectgarbage (line 196) | static int luaB_collectgarbage (lua_State *L) {
  function luaB_type (line 223) | static int luaB_type (lua_State *L) {
  function luaB_next (line 230) | static int luaB_next (lua_State *L) {
  function luaB_pairs (line 242) | static int luaB_pairs (lua_State *L) {
  function ipairsaux (line 251) | static int ipairsaux (lua_State *L) {
  function luaB_ipairs (line 261) | static int luaB_ipairs (lua_State *L) {
  function load_aux (line 270) | static int load_aux (lua_State *L, int status) {
  function luaB_loadstring (line 281) | static int luaB_loadstring (lua_State *L) {
  function luaB_loadfile (line 289) | static int luaB_loadfile (lua_State *L) {
  function luaB_load (line 319) | static int luaB_load (lua_State *L) {
  function luaB_dofile (line 329) | static int luaB_dofile (lua_State *L) {
  function luaB_assert (line 338) | static int luaB_assert (lua_State *L) {
  function luaB_unpack (line 346) | static int luaB_unpack (lua_State *L) {
  function luaB_select (line 362) | static int luaB_select (lua_State *L) {
  function luaB_pcall (line 378) | static int luaB_pcall (lua_State *L) {
  function luaB_xpcall (line 388) | static int luaB_xpcall (lua_State *L) {
  function luaB_tostring (line 400) | static int luaB_tostring (lua_State *L) {
  function luaB_newproxy (line 425) | static int luaB_newproxy (lua_State *L) {
  function costatus (line 494) | static int costatus (lua_State *L, lua_State *co) {
  function luaB_costatus (line 514) | static int luaB_costatus (lua_State *L) {
  function auxresume (line 522) | static int auxresume (lua_State *L, lua_State *co, int narg) {
  function luaB_coresume (line 546) | static int luaB_coresume (lua_State *L) {
  function luaB_auxwrap (line 564) | static int luaB_auxwrap (lua_State *L) {
  function luaB_cstacksize (line 580) | static int luaB_cstacksize (lua_State *L)
  function luaB_cocreate (line 588) | static int luaB_cocreate (lua_State *L) {
  function luaB_cowrap (line 606) | static int luaB_cowrap (lua_State *L) {
  function luaB_yield (line 613) | static int luaB_yield (lua_State *L) {
  function luaB_corunning (line 618) | static int luaB_corunning (lua_State *L) {
  function auxopen (line 641) | static void auxopen (lua_State *L, const char *name,
  function base_open (line 649) | static void base_open (lua_State *L) {
  function LUALIB_API (line 671) | LUALIB_API int luaopen_base (lua_State *L) {

FILE: src/lcoco.c
  type LPFIBER_START_ROUTINE (line 70) | typedef LPFIBER_START_ROUTINE coco_MainFunc;
  function coco_switch (line 106) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  function coco_switch (line 118) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  function coco_wrap_main (line 139) | static void coco_wrap_main(void)
  function coco_switch (line 145) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  function coco_switch (line 175) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  function coco_switch (line 260) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  function coco_switch (line 341) | static inline void coco_switch(coco_ctx from, coco_ctx to)
  type coco_State (line 592) | struct coco_State {
  function coco_start (line 646) | static void coco_start(lua_State *L, void *ud)
  function coco_main (line 661) | coco_main(COCO_MAIN_PARAM)
  function lua_State (line 675) | lua_State *lua_newcthread(lua_State *OL, int cstacksize)
  function luaCOCO_free (line 693) | void luaCOCO_free(lua_State *L)
  function luaCOCO_resume (line 699) | int luaCOCO_resume(lua_State *L, int nargs)
  function luaCOCO_yield (line 713) | int luaCOCO_yield(lua_State *L)
  function luaCOCO_cstacksize (line 733) | int luaCOCO_cstacksize(int cstacksize)
  function luaCOCO_mainthread (line 746) | int luaCOCO_mainthread(lua_State *L) {

FILE: src/lcoco.h
  type coco_State (line 23) | typedef struct coco_State coco_State;
  type coco_State (line 38) | struct coco_State {

FILE: src/lcode.c
  function isnumeral (line 30) | static int isnumeral(expdesc *e) {
  function luaK_nil (line 35) | void luaK_nil (FuncState *fs, int from, int n) {
  function luaK_jump (line 59) | int luaK_jump (FuncState *fs) {
  function luaK_ret (line 69) | void luaK_ret (FuncState *fs, int first, int nret) {
  function condjump (line 74) | static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
  function fixjump (line 80) | static void fixjump (FuncState *fs, int pc, int dest) {
  function luaK_getlabel (line 94) | int luaK_getlabel (FuncState *fs) {
  function getjump (line 100) | static int getjump (FuncState *fs, int pc) {
  function Instruction (line 109) | static Instruction *getjumpcontrol (FuncState *fs, int pc) {
  function need_value (line 122) | static int need_value (FuncState *fs, int list) {
  function patchtestreg (line 131) | static int patchtestreg (FuncState *fs, int node, int reg) {
  function removevalues (line 144) | static void removevalues (FuncState *fs, int list) {
  function patchlistaux (line 150) | static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
  function dischargejpc (line 163) | static void dischargejpc (FuncState *fs) {
  function luaK_patchlist (line 169) | void luaK_patchlist (FuncState *fs, int list, int target) {
  function luaK_patchtohere (line 179) | void luaK_patchtohere (FuncState *fs, int list) {
  function luaK_concat (line 185) | void luaK_concat (FuncState *fs, int *l1, int l2) {
  function luaK_checkstack (line 199) | void luaK_checkstack (FuncState *fs, int n) {
  function luaK_reserveregs (line 209) | void luaK_reserveregs (FuncState *fs, int n) {
  function freereg (line 215) | static void freereg (FuncState *fs, int reg) {
  function freeexp (line 223) | static void freeexp (FuncState *fs, expdesc *e) {
  function addk (line 229) | static int addk (FuncState *fs, TValue *k, TValue *v) {
  function luaK_stringK (line 250) | int luaK_stringK (FuncState *fs, TString *s) {
  function luaK_numberK (line 257) | int luaK_numberK (FuncState *fs, lua_Number r) {
  function boolK (line 264) | static int boolK (FuncState *fs, int b) {
  function nilK (line 271) | static int nilK (FuncState *fs) {
  function luaK_setreturns (line 280) | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
  function luaK_setoneret (line 292) | void luaK_setoneret (FuncState *fs, expdesc *e) {
  function luaK_dischargevars (line 304) | void luaK_dischargevars (FuncState *fs, expdesc *e) {
  function code_label (line 337) | static int code_label (FuncState *fs, int A, int b, int jump) {
  function discharge2reg (line 343) | static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
  function discharge2anyreg (line 382) | static void discharge2anyreg (FuncState *fs, expdesc *e) {
  function exp2reg (line 390) | static void exp2reg (FuncState *fs, expdesc *e, int reg) {
  function luaK_exp2nextreg (line 414) | void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
  function luaK_exp2anyreg (line 422) | int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
  function luaK_exp2val (line 436) | void luaK_exp2val (FuncState *fs, expdesc *e) {
  function luaK_exp2RK (line 444) | int luaK_exp2RK (FuncState *fs, expdesc *e) {
  function luaK_storevar (line 472) | void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
  function luaK_self (line 503) | void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
  function invertjump (line 516) | static void invertjump (FuncState *fs, expdesc *e) {
  function jumponcond (line 524) | static int jumponcond (FuncState *fs, expdesc *e, int cond) {
  function luaK_goiftrue (line 539) | void luaK_goiftrue (FuncState *fs, expdesc *e) {
  function luaK_goiffalse (line 570) | static void luaK_goiffalse (FuncState *fs, expdesc *e) {
  function codenot (line 600) | static void codenot (FuncState *fs, expdesc *e) {
  function luaK_indexed (line 635) | void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
  function constfolding (line 641) | static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
  function codearith (line 667) | static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e...
  function codecomp (line 687) | static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
  function luaK_prefix (line 703) | void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
  function luaK_infix (line 724) | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
  function luaK_posfix (line 751) | void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
  function luaK_fixline (line 798) | void luaK_fixline (FuncState *fs, int line) {
  function luaK_code (line 803) | static int luaK_code (FuncState *fs, Instruction i, int line) {
  function luaK_codeABC (line 818) | int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
  function luaK_codeABx (line 826) | int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
  function luaK_setlist (line 833) | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {

FILE: src/lcode.h
  type BinOpr (line 26) | typedef enum BinOpr {
  type UnOpr (line 36) | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;

FILE: src/ldblib.c
  function db_getregistry (line 22) | static int db_getregistry (lua_State *L) {
  function db_getmetatable (line 28) | static int db_getmetatable (lua_State *L) {
  function db_setmetatable (line 37) | static int db_setmetatable (lua_State *L) {
  function db_getfenv (line 47) | static int db_getfenv (lua_State *L) {
  function db_setfenv (line 54) | static int db_setfenv (lua_State *L) {
  function settabss (line 64) | static void settabss (lua_State *L, const char *i, const char *v) {
  function settabsi (line 70) | static void settabsi (lua_State *L, const char *i, int v) {
  function lua_State (line 76) | static lua_State *getthread (lua_State *L, int *arg) {
  function treatstackoption (line 88) | static void treatstackoption (lua_State *L, lua_State *L1, const char *f...
  function db_getinfo (line 99) | static int db_getinfo (lua_State *L) {
  function db_getlocal (line 144) | static int db_getlocal (lua_State *L) {
  function db_setlocal (line 165) | static int db_setlocal (lua_State *L) {
  function auxupvalue (line 179) | static int auxupvalue (lua_State *L, int get) {
  function db_getupvalue (line 192) | static int db_getupvalue (lua_State *L) {
  function db_setupvalue (line 197) | static int db_setupvalue (lua_State *L) {
  function hookf (line 207) | static void hookf (lua_State *L, lua_Debug *ar) {
  function makemask (line 225) | static int makemask (const char *smask, int count) {
  function gethooktable (line 245) | static void gethooktable (lua_State *L) {
  function db_sethook (line 258) | static int db_sethook (lua_State *L) {
  function db_gethook (line 282) | static int db_gethook (lua_State *L) {
  function db_debug (line 302) | static int db_debug (lua_State *L) {
  function db_errorfb (line 322) | static int db_errorfb (lua_State *L) {
  function LUALIB_API (line 394) | LUALIB_API int luaopen_debug (lua_State *L) {

FILE: src/ldebug.c
  function currentpc (line 36) | static int currentpc (lua_State *L, CallInfo *ci) {
  function currentline (line 44) | static int currentline (lua_State *L, CallInfo *ci) {
  function LUA_API (line 56) | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int coun...
  function LUA_API (line 69) | LUA_API lua_Hook lua_gethook (lua_State *L) {
  function LUA_API (line 74) | LUA_API int lua_gethookmask (lua_State *L) {
  function LUA_API (line 79) | LUA_API int lua_gethookcount (lua_State *L) {
  function LUA_API (line 84) | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
  function Proto (line 107) | static Proto *getluaproto (CallInfo *ci) {
  function LUA_API (line 127) | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int...
  function LUA_API (line 138) | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int...
  function funcinfo (line 150) | static void funcinfo (lua_Debug *ar, Closure *cl) {
  function info_tailcall (line 167) | static void info_tailcall (lua_Debug *ar) {
  function collectvalidlines (line 177) | static void collectvalidlines (lua_State *L, Closure *f) {
  function auxgetinfo (line 193) | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
  function LUA_API (line 232) | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
  function precheck (line 276) | static int precheck (const Proto *pt) {
  function luaG_checkopenop (line 290) | int luaG_checkopenop (Instruction i) {
  function checkArgMode (line 304) | static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) {
  function Instruction (line 317) | static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
  function luaG_checkcode (line 484) | int luaG_checkcode (const Proto *pt) {
  function isinstack (line 566) | static int isinstack (CallInfo *ci, const TValue *o) {
  function luaG_typeerror (line 574) | void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
  function luaG_concaterror (line 588) | void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
  function luaG_aritherror (line 595) | void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
  function luaG_ordererror (line 603) | int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
  function addinfo (line 614) | static void addinfo (lua_State *L, const char *msg) {
  function luaG_errormsg (line 625) | void luaG_errormsg (lua_State *L) {
  function luaG_runerror (line 638) | void luaG_runerror (lua_State *L, const char *fmt, ...) {

FILE: src/ldo.c
  type lua_longjmp (line 44) | struct lua_longjmp {
  function luaD_seterrorobj (line 51) | void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {
  function restore_stack_limit (line 73) | static void restore_stack_limit (lua_State *L) {
  function resetstack (line 83) | static void resetstack (lua_State *L, int status) {
  function luaD_throw (line 96) | void luaD_throw (lua_State *L, int errcode) {
  function luaD_rawrunprotected (line 115) | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
  function correctstack (line 130) | static void correctstack (lua_State *L, TValue *oldstack) {
  function luaD_reallocstack (line 145) | void luaD_reallocstack (lua_State *L, int newsize) {
  function luaD_reallocCI (line 156) | void luaD_reallocCI (lua_State *L, int newsize) {
  function luaD_growstack (line 165) | void luaD_growstack (lua_State *L, int n) {
  function CallInfo (line 173) | static CallInfo *growCI (lua_State *L) {
  function luaD_callhook (line 185) | void luaD_callhook (lua_State *L, int event, int line) {
  function StkId (line 212) | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {
  function StkId (line 256) | StkId luaD_tryfuncTM (lua_State *L, StkId func) {
  function luaD_precall_lua (line 277) | int luaD_precall_lua (lua_State *L, StkId func, int nresults) {
  function luaD_precall_c (line 317) | int luaD_precall_c (lua_State *L, StkId func, int nresults) {
  function luaD_precall (line 343) | int luaD_precall (lua_State *L, StkId func, int nresults) {
  function StkId (line 365) | static StkId callrethooks (lua_State *L, StkId firstResult) {
  function luaD_poscall (line 374) | int luaD_poscall (lua_State *L, StkId firstResult) {
  function luaD_call (line 402) | void luaD_call (lua_State *L, StkId func, int nResults) {
  function resume (line 416) | static void resume (lua_State *L, void *ud) {
  function resume_error (line 441) | static int resume_error (lua_State *L, const char *msg) {
  function LUA_API (line 450) | LUA_API int lua_resume (lua_State *L, int nargs) {
  function LUA_API (line 470) | LUA_API int lua_yield (lua_State *L, int nresults) {
  function luaD_pcall (line 482) | int luaD_pcall (lua_State *L, Pfunc func, void *u,
  type SParser (line 511) | struct SParser {  /* data to `f_parser' */
  function f_parser (line 517) | static void f_parser (lua_State *L, void *ud) {
  function luaD_protectedparser (line 537) | int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {

FILE: src/ldump.c
  type DumpState (line 18) | typedef struct {
  function DumpBlock (line 29) | static void DumpBlock(const void* b, size_t size, DumpState* D)
  function DumpChar (line 39) | static void DumpChar(int y, DumpState* D)
  function DumpInt (line 45) | static void DumpInt(int x, DumpState* D)
  function DumpNumber (line 50) | static void DumpNumber(lua_Number x, DumpState* D)
  function DumpVector (line 55) | static void DumpVector(const void* b, int n, size_t size, DumpState* D)
  function DumpString (line 61) | static void DumpString(const TString* s, DumpState* D)
  function DumpConstants (line 80) | static void DumpConstants(const Proto* f, DumpState* D)
  function DumpDebug (line 111) | static void DumpDebug(const Proto* f, DumpState* D)
  function DumpFunction (line 129) | static void DumpFunction(const Proto* f, const TString* p, DumpState* D)
  function DumpHeader (line 143) | static void DumpHeader(DumpState* D)
  function luaU_dump (line 153) | int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, i...

FILE: src/lfunc.c
  function Closure (line 24) | Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) {
  function Closure (line 35) | Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) {
  function UpVal (line 47) | UpVal *luaF_newupval (lua_State *L) {
  function UpVal (line 56) | UpVal *luaF_findupval (lua_State *L, StkId level) {
  function unlinkupval (line 85) | static void unlinkupval (UpVal *uv) {
  function luaF_freeupval (line 92) | void luaF_freeupval (lua_State *L, UpVal *uv) {
  function luaF_close (line 99) | void luaF_close (lua_State *L, StkId level) {
  function Proto (line 118) | Proto *luaF_newproto (lua_State *L) {
  function luaF_freeproto (line 145) | void luaF_freeproto (lua_State *L, Proto *f) {
  function luaF_freeclosure (line 157) | void luaF_freeclosure (lua_State *L, Closure *c) {

FILE: src/lgc.c
  function removeentry (line 62) | static void removeentry (Node *n) {
  function reallymarkobject (line 69) | static void reallymarkobject (global_State *g, GCObject *o) {
  function marktmu (line 115) | static void marktmu (global_State *g) {
  function luaC_separateudata (line 128) | size_t luaC_separateudata (lua_State *L, int all) {
  function traversetable (line 158) | static int traversetable (global_State *g, Table *h) {
  function traverseproto (line 203) | static void traverseproto (global_State *g, Proto *f) {
  function traverseclosure (line 224) | static void traverseclosure (global_State *g, Closure *cl) {
  function checkstacksizes (line 243) | static void checkstacksizes (lua_State *L, StkId max) {
  function traversestack (line 258) | static void traversestack (global_State *g, lua_State *l) {
  function l_mem (line 281) | static l_mem propagatemark (global_State *g) {
  function propagateall (line 327) | static size_t propagateall (global_State *g) {
  function iscleared (line 341) | static int iscleared (const TValue *o, int iskey) {
  function cleartable (line 355) | static void cleartable (GCObject *l) {
  function freeobj (line 382) | static void freeobj (lua_State *L, GCObject *o) {
  function GCObject (line 411) | static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
  function checkSizes (line 433) | static void checkSizes (lua_State *L) {
  function GCTM (line 449) | static void GCTM (lua_State *L) {
  function luaC_callGCTM (line 481) | void luaC_callGCTM (lua_State *L) {
  function luaC_freeall (line 487) | void luaC_freeall (lua_State *L) {
  function markmt (line 497) | static void markmt (global_State *g) {
  function markroot (line 505) | static void markroot (lua_State *L) {
  function remarkupvals (line 519) | static void remarkupvals (global_State *g) {
  function atomic (line 529) | static void atomic (lua_State *L) {
  function l_mem (line 560) | static l_mem singlestep (lua_State *L) {
  function luaC_step (line 614) | void luaC_step (lua_State *L) {
  function luaC_fullgc (line 645) | void luaC_fullgc (lua_State *L) {
  function luaC_barrierf (line 674) | void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) {
  function luaC_barrierback (line 687) | void luaC_barrierback (lua_State *L, Table *t) {
  function luaC_marknew (line 698) | void luaC_marknew (lua_State *L, GCObject *o) {
  function luaC_link (line 706) | void luaC_link (lua_State *L, GCObject *o, lu_byte tt) {
  function luaC_linkupval (line 715) | void luaC_linkupval (lua_State *L, UpVal *uv) {

FILE: src/linit.c
  function LUALIB_API (line 30) | LUALIB_API void luaL_openlibs (lua_State *L) {

FILE: src/liolib.c
  function pushresult (line 30) | static int pushresult (lua_State *L, int i, const char *filename) {
  function fileerror (line 48) | static void fileerror (lua_State *L, int arg, const char *filename) {
  function io_type (line 57) | static int io_type (lua_State *L) {
  function FILE (line 72) | static FILE *tofile (lua_State *L) {
  function FILE (line 86) | static FILE **newfile (lua_State *L) {
  function io_noclose (line 98) | static int io_noclose (lua_State *L) {
  function io_pclose (line 108) | static int io_pclose (lua_State *L) {
  function io_fclose (line 119) | static int io_fclose (lua_State *L) {
  function aux_close (line 127) | static int aux_close (lua_State *L) {
  function io_close (line 134) | static int io_close (lua_State *L) {
  function io_gc (line 142) | static int io_gc (lua_State *L) {
  function io_tostring (line 151) | static int io_tostring (lua_State *L) {
  function io_open (line 161) | static int io_open (lua_State *L) {
  function io_popen (line 174) | static int io_popen (lua_State *L) {
  function io_tmpfile (line 183) | static int io_tmpfile (lua_State *L) {
  function FILE (line 190) | static FILE *getiofile (lua_State *L, int findex) {
  function g_iofile (line 200) | static int g_iofile (lua_State *L, int f, const char *mode) {
  function io_input (line 221) | static int io_input (lua_State *L) {
  function io_output (line 226) | static int io_output (lua_State *L) {
  function aux_lines (line 234) | static void aux_lines (lua_State *L, int idx, int toclose) {
  function f_lines (line 241) | static int f_lines (lua_State *L) {
  function io_lines (line 248) | static int io_lines (lua_State *L) {
  function read_number (line 273) | static int read_number (lua_State *L, FILE *f) {
  function test_eof (line 283) | static int test_eof (lua_State *L, FILE *f) {
  function read_line (line 291) | static int read_line (lua_State *L, FILE *f) {
  function read_chars (line 313) | static int read_chars (lua_State *L, FILE *f, size_t n) {
  function g_read (line 331) | static int g_read (lua_State *L, FILE *f, int first) {
  function io_read (line 378) | static int io_read (lua_State *L) {
  function f_read (line 383) | static int f_read (lua_State *L) {
  function io_readline (line 388) | static int io_readline (lua_State *L) {
  function g_write (line 410) | static int g_write (lua_State *L, FILE *f, int arg) {
  function io_write (line 429) | static int io_write (lua_State *L) {
  function f_write (line 434) | static int f_write (lua_State *L) {
  function f_seek (line 439) | static int f_seek (lua_State *L) {
  function f_setvbuf (line 455) | static int f_setvbuf (lua_State *L) {
  function io_flush (line 467) | static int io_flush (lua_State *L) {
  function f_flush (line 472) | static int f_flush (lua_State *L) {
  function createmeta (line 507) | static void createmeta (lua_State *L) {
  function createstdfile (line 515) | static void createstdfile (lua_State *L, FILE *f, int k, const char *fna...
  function newfenv (line 527) | static void newfenv (lua_State *L, lua_CFunction cls) {
  function LUALIB_API (line 534) | LUALIB_API int luaopen_io (lua_State *L) {

FILE: src/llex.c
  function save (line 51) | static void save (LexState *ls, int c) {
  function luaX_init (line 64) | void luaX_init (lua_State *L) {
  function luaX_lexerror (line 102) | void luaX_lexerror (LexState *ls, const char *msg, int token) {
  function luaX_syntaxerror (line 112) | void luaX_syntaxerror (LexState *ls, const char *msg) {
  function TString (line 117) | TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
  function inclinenumber (line 127) | static void inclinenumber (LexState *ls) {
  function luaX_setinput (line 138) | void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) {
  function check_next (line 161) | static int check_next (LexState *ls, const char *set) {
  function buffreplace (line 169) | static void buffreplace (LexState *ls, char from, char to) {
  function trydecpoint (line 177) | static void trydecpoint (LexState *ls, SemInfo *seminfo) {
  function read_numeral (line 192) | static void read_numeral (LexState *ls, SemInfo *seminfo) {
  function skip_sep (line 208) | static int skip_sep (LexState *ls) {
  function read_long_string (line 221) | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
  function read_string (line 276) | static void read_string (LexState *ls, int del, SemInfo *seminfo) {
  function llex (line 332) | static int llex (LexState *ls, SemInfo *seminfo) {
  function luaX_next (line 446) | void luaX_next (LexState *ls) {
  function luaX_lookahead (line 457) | void luaX_lookahead (LexState *ls) {

FILE: src/llex.h
  type RESERVED (line 24) | enum RESERVED {
  type SemInfo (line 43) | typedef union {
  type Token (line 49) | typedef struct Token {
  type LexState (line 55) | typedef struct LexState {

FILE: src/llimits.h
  type LUAI_UINT32 (line 18) | typedef LUAI_UINT32 lu_int32;
  type LUAI_UMEM (line 20) | typedef LUAI_UMEM lu_mem;
  type LUAI_MEM (line 22) | typedef LUAI_MEM l_mem;
  type lu_byte (line 27) | typedef unsigned char lu_byte;
  type LUAI_USER_ALIGNMENT_T (line 47) | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
  type LUAI_UACNUMBER (line 51) | typedef LUAI_UACNUMBER l_uacNumber;
  type lu_int32 (line 88) | typedef lu_int32 Instruction;

FILE: src/lmathlib.c
  function math_abs (line 26) | static int math_abs (lua_State *L) {
  function math_sin (line 31) | static int math_sin (lua_State *L) {
  function math_sinh (line 36) | static int math_sinh (lua_State *L) {
  function math_cos (line 41) | static int math_cos (lua_State *L) {
  function math_cosh (line 46) | static int math_cosh (lua_State *L) {
  function math_tan (line 51) | static int math_tan (lua_State *L) {
  function math_tanh (line 56) | static int math_tanh (lua_State *L) {
  function math_asin (line 61) | static int math_asin (lua_State *L) {
  function math_acos (line 66) | static int math_acos (lua_State *L) {
  function math_atan (line 71) | static int math_atan (lua_State *L) {
  function math_atan2 (line 76) | static int math_atan2 (lua_State *L) {
  function math_ceil (line 81) | static int math_ceil (lua_State *L) {
  function math_floor (line 86) | static int math_floor (lua_State *L) {
  function math_fmod (line 91) | static int math_fmod (lua_State *L) {
  function math_modf (line 96) | static int math_modf (lua_State *L) {
  function math_sqrt (line 104) | static int math_sqrt (lua_State *L) {
  function math_pow (line 109) | static int math_pow (lua_State *L) {
  function math_log (line 114) | static int math_log (lua_State *L) {
  function math_log10 (line 119) | static int math_log10 (lua_State *L) {
  function math_exp (line 124) | static int math_exp (lua_State *L) {
  function math_deg (line 129) | static int math_deg (lua_State *L) {
  function math_rad (line 134) | static int math_rad (lua_State *L) {
  function math_frexp (line 139) | static int math_frexp (lua_State *L) {
  function math_ldexp (line 146) | static int math_ldexp (lua_State *L) {
  function math_min (line 153) | static int math_min (lua_State *L) {
  function math_max (line 167) | static int math_max (lua_State *L) {
  function math_random (line 181) | static int math_random (lua_State *L) {
  function math_randomseed (line 209) | static int math_randomseed (lua_State *L) {
  function LUALIB_API (line 251) | LUALIB_API int luaopen_math (lua_State *L) {

FILE: src/loadlib.c
  function ll_unloadlib (line 63) | static void ll_unloadlib (void *lib) {
  function lua_CFunction (line 75) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  function setprogdir (line 97) | static void setprogdir (lua_State *L) {
  function pusherror (line 112) | static void pusherror (lua_State *L) {
  function ll_unloadlib (line 122) | static void ll_unloadlib (void *lib) {
  function lua_CFunction (line 134) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  function pusherror (line 159) | static void pusherror (lua_State *L) {
  function ll_unloadlib (line 186) | static void ll_unloadlib (void *lib) {
  function lua_CFunction (line 212) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  function ll_unloadlib (line 239) | static void ll_unloadlib (void *lib) {
  function lua_CFunction (line 251) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
  function gctm (line 286) | static int gctm (lua_State *L) {
  function ll_loadfunc (line 294) | static int ll_loadfunc (lua_State *L, const char *path, const char *sym) {
  function ll_loadlib (line 309) | static int ll_loadlib (lua_State *L) {
  function readable (line 332) | static int readable (const char *filename) {
  function loaderror (line 374) | static void loaderror (lua_State *L, const char *filename) {
  function loader_Lua (line 380) | static int loader_Lua (lua_State *L) {
  function loader_C (line 402) | static int loader_C (lua_State *L) {
  function loader_Croot (line 414) | static int loader_Croot (lua_State *L) {
  function loader_preload (line 435) | static int loader_preload (lua_State *L) {
  function ll_require (line 451) | static int ll_require (lua_State *L) {
  function setfenv (line 513) | static void setfenv (lua_State *L) {
  function dooptions (line 525) | static void dooptions (lua_State *L, int n) {
  function modinit (line 535) | static void modinit (lua_State *L, const char *modname) {
  function ll_module (line 550) | static int ll_module (lua_State *L) {
  function ll_seeall (line 578) | static int ll_seeall (lua_State *L) {
  function setpath (line 598) | static void setpath (lua_State *L, const char *fieldname, const char *en...
  function LUALIB_API (line 633) | LUALIB_API int luaopen_package (lua_State *L) {

FILE: src/lobject.c
  function luaO_int2fb (line 35) | int luaO_int2fb (unsigned int x) {
  function luaO_fb2int (line 47) | int luaO_fb2int (int x) {
  function luaO_log2 (line 54) | int luaO_log2 (unsigned int x) {
  function luaO_rawequalObj (line 72) | int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
  function luaO_str2d (line 90) | int luaO_str2d (const char *s, lua_Number *result) {
  function pushstr (line 104) | static void pushstr (lua_State *L, const char *str) {
  function luaO_chunkid (line 182) | void luaO_chunkid (char *out, const char *source, size_t bufflen) {

FILE: src/lobject.h
  type GCObject (line 36) | typedef union GCObject GCObject;
  type GCheader (line 49) | typedef struct GCheader {
  type Value (line 59) | typedef union {
  type lua_TValue (line 73) | struct lua_TValue {
  type TString (line 202) | typedef union TString {
  type Udata (line 218) | typedef union Udata {
  type Proto (line 234) | typedef struct Proto {
  type LocVar (line 266) | typedef struct LocVar {
  type UpVal (line 278) | typedef struct UpVal {
  type CClosure (line 299) | typedef struct CClosure {
  type LClosure (line 306) | typedef struct LClosure {
  type Closure (line 313) | typedef union Closure {
  type TKey (line 327) | typedef union TKey {
  type Node (line 336) | typedef struct Node {
  type Table (line 342) | typedef struct Table {

FILE: src/lopcodes.h
  type OpMode (line 31) | enum OpMode {iABC, iABx, iAsBx}
  type OpCode (line 150) | typedef enum {
  type OpArgMask (line 245) | enum OpArgMask {

FILE: src/loslib.c
  function os_pushresult (line 23) | static int os_pushresult (lua_State *L, int i, const char *filename) {
  function os_execute (line 38) | static int os_execute (lua_State *L) {
  function os_remove (line 44) | static int os_remove (lua_State *L) {
  function os_rename (line 50) | static int os_rename (lua_State *L) {
  function os_tmpname (line 57) | static int os_tmpname (lua_State *L) {
  function os_getenv (line 68) | static int os_getenv (lua_State *L) {
  function os_clock (line 74) | static int os_clock (lua_State *L) {
  function setfield (line 88) | static void setfield (lua_State *L, const char *key, int value) {
  function setboolfield (line 93) | static void setboolfield (lua_State *L, const char *key, int value) {
  function getboolfield (line 100) | static int getboolfield (lua_State *L, const char *key) {
  function getfield (line 109) | static int getfield (lua_State *L, const char *key, int d) {
  function os_date (line 124) | static int os_date (lua_State *L) {
  function os_time (line 170) | static int os_time (lua_State *L) {
  function os_difftime (line 195) | static int os_difftime (lua_State *L) {
  function os_setlocale (line 204) | static int os_setlocale (lua_State *L) {
  function os_exit (line 216) | static int os_exit (lua_State *L) {
  function LUALIB_API (line 239) | LUALIB_API int luaopen_os (lua_State *L) {

FILE: src/lparser.c
  type BlockCnt (line 40) | typedef struct BlockCnt {
  function anchor_token (line 57) | static void anchor_token (LexState *ls) {
  function error_expected (line 65) | static void error_expected (LexState *ls, int token) {
  function errorlimit (line 71) | static void errorlimit (FuncState *fs, int limit, const char *what) {
  function testnext (line 80) | static int testnext (LexState *ls, int c) {
  function check (line 89) | static void check (LexState *ls, int c) {
  function checknext (line 94) | static void checknext (LexState *ls, int c) {
  function check_match (line 104) | static void check_match (LexState *ls, int what, int who, int where) {
  function TString (line 117) | static TString *str_checkname (LexState *ls) {
  function init_exp (line 126) | static void init_exp (expdesc *e, expkind k, int i) {
  function codestring (line 133) | static void codestring (LexState *ls, expdesc *e, TString *s) {
  function checkname (line 138) | static void checkname(LexState *ls, expdesc *e) {
  function registerlocalvar (line 143) | static int registerlocalvar (LexState *ls, TString *varname) {
  function new_localvar (line 160) | static void new_localvar (LexState *ls, TString *name, int n) {
  function adjustlocalvars (line 167) | static void adjustlocalvars (LexState *ls, int nvars) {
  function removevars (line 176) | static void removevars (LexState *ls, int tolevel) {
  function indexupvalue (line 183) | static int indexupvalue (FuncState *fs, TString *name, expdesc *v) {
  function searchvar (line 207) | static int searchvar (FuncState *fs, TString *n) {
  function markupval (line 217) | static void markupval (FuncState *fs, int level) {
  function singlevaraux (line 224) | static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int ba...
  function singlevar (line 248) | static void singlevar (LexState *ls, expdesc *var) {
  function adjust_assign (line 256) | static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *...
  function enterlevel (line 276) | static void enterlevel (LexState *ls) {
  function enterblock (line 285) | static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
  function leaveblock (line 296) | static void leaveblock (FuncState *fs) {
  function pushclosure (line 310) | static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
  function open_func (line 328) | static void open_func (LexState *ls, FuncState *fs) {
  function close_func (line 356) | static void close_func (LexState *ls) {
  function Proto (line 383) | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *nam...
  function field (line 407) | static void field (LexState *ls, expdesc *v) {
  function yindex (line 418) | static void yindex (LexState *ls, expdesc *v) {
  type ConsControl (line 434) | struct ConsControl {
  function recfield (line 443) | static void recfield (LexState *ls, struct ConsControl *cc) {
  function closelistfield (line 464) | static void closelistfield (FuncState *fs, struct ConsControl *cc) {
  function lastlistfield (line 475) | static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
  function listfield (line 490) | static void listfield (LexState *ls, struct ConsControl *cc) {
  function constructor (line 498) | static void constructor (LexState *ls, expdesc *t) {
  function parlist (line 543) | static void parlist (LexState *ls) {
  function body (line 576) | static void body (LexState *ls, expdesc *e, int needself, int line) {
  function explist1 (line 596) | static int explist1 (LexState *ls, expdesc *v) {
  function funcargs (line 609) | static void funcargs (LexState *ls, expdesc *f) {
  function prefixexp (line 667) | static void prefixexp (LexState *ls, expdesc *v) {
  function primaryexp (line 690) | static void primaryexp (LexState *ls, expdesc *v) {
  function simpleexp (line 727) | static void simpleexp (LexState *ls, expdesc *v) {
  function UnOpr (line 778) | static UnOpr getunopr (int op) {
  function BinOpr (line 788) | static BinOpr getbinopr (int op) {
  function BinOpr (line 828) | static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
  function expr (line 856) | static void expr (LexState *ls, expdesc *v) {
  function block_follow (line 871) | static int block_follow (int token) {
  function block (line 881) | static void block (LexState *ls) {
  type LHS_assign (line 896) | struct LHS_assign {
  function check_conflict (line 908) | static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc...
  function assignment (line 931) | static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
  function cond (line 965) | static int cond (LexState *ls) {
  function breakstat (line 975) | static void breakstat (LexState *ls) {
  function whilestat (line 991) | static void whilestat (LexState *ls, int line) {
  function repeatstat (line 1010) | static void repeatstat (LexState *ls, int line) {
  function exp1 (line 1036) | static int exp1 (LexState *ls) {
  function forbody (line 1046) | static void forbody (LexState *ls, int base, int line, int nvars, int is...
  function fornum (line 1067) | static void fornum (LexState *ls, TString *varname, int line) {
  function forlist (line 1089) | static void forlist (LexState *ls, TString *indexname) {
  function forstat (line 1112) | static void forstat (LexState *ls, int line) {

FILE: src/lparser.h
  type expkind (line 19) | typedef enum {
  type expdesc (line 37) | typedef struct expdesc {
  type upvaldesc (line 48) | typedef struct upvaldesc {
  type BlockCnt (line 54) | struct BlockCnt
  type FuncState (line 58) | typedef struct FuncState {

FILE: src/lstate.c
  type LG (line 35) | typedef struct LG {
  function stack_init (line 42) | static void stack_init (lua_State *L1, lua_State *L) {
  function freestack (line 61) | static void freestack (lua_State *L, lua_State *L1) {
  function f_luaopen (line 70) | static void f_luaopen (lua_State *L, void *ud) {
  function preinit_state (line 84) | static void preinit_state (lua_State *L, global_State *g) {
  function close_state (line 105) | static void close_state (lua_State *L) {
  function lua_State (line 119) | lua_State *luaE_newthread (lua_State *L) {
  function luaE_freethread (line 137) | void luaE_freethread (lua_State *L, lua_State *L1) {
  function LUA_API (line 146) | LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
  function callallgcTM (line 200) | static void callallgcTM (lua_State *L, void *ud) {
  function LUA_API (line 206) | LUA_API void lua_close (lua_State *L) {

FILE: src/lstate.h
  type lua_longjmp (line 21) | struct lua_longjmp
  type stringtable (line 41) | typedef struct stringtable {
  type CallInfo (line 51) | typedef struct CallInfo {
  type lua_State (line 97) | struct lua_State
  type Table (line 99) | struct Table
  type lua_State (line 108) | struct lua_State {
  type Table (line 148) | struct Table
  type Proto (line 149) | struct Proto
  type UpVal (line 150) | struct UpVal
  type lua_State (line 151) | struct lua_State

FILE: src/lstring.c
  function luaS_resize (line 22) | void luaS_resize (lua_State *L, int newsize) {
  function TString (line 52) | static TString *newlstr (lua_State *L, const char *str, size_t l,
  function TString (line 77) | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
  function Udata (line 98) | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {

FILE: src/lstrlib.c
  function str_len (line 28) | static int str_len (lua_State *L) {
  function posrelat (line 36) | static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {
  function str_sub (line 43) | static int str_sub (lua_State *L) {
  function str_reverse (line 57) | static int str_reverse (lua_State *L) {
  function str_lower (line 68) | static int str_lower (lua_State *L) {
  function str_upper (line 81) | static int str_upper (lua_State *L) {
  function str_rep (line 93) | static int str_rep (lua_State *L) {
  function str_byte (line 106) | static int str_byte (lua_State *L) {
  function str_char (line 125) | static int str_char (lua_State *L) {
  function writer (line 140) | static int writer (lua_State *L, const void* b, size_t size, void* B) {
  function str_dump (line 147) | static int str_dump (lua_State *L) {
  type MatchState (line 170) | typedef struct MatchState {
  function check_capture (line 186) | static int check_capture (MatchState *ms, int l) {
  function capture_to_close (line 194) | static int capture_to_close (MatchState *ms) {
  function match_class (line 226) | static int match_class (int c, int cl) {
  function matchbracketclass (line 245) | static int matchbracketclass (int c, const char *p, const char *ec) {
  function singlematch (line 268) | static int singlematch (int c, const char *p, const char *ep) {
  function push_onecapture (line 466) | static void push_onecapture (MatchState *ms, int i, const char *s,
  function push_captures (line 485) | static int push_captures (MatchState *ms, const char *s, const char *e) {
  function str_find_aux (line 495) | static int str_find_aux (lua_State *L, int find) {
  function str_find (line 538) | static int str_find (lua_State *L) {
  function str_match (line 543) | static int str_match (lua_State *L) {
  function gmatch_aux (line 548) | static int gmatch_aux (lua_State *L) {
  function gmatch (line 574) | static int gmatch (lua_State *L) {
  function gfind_nodef (line 584) | static int gfind_nodef (lua_State *L) {
  function add_s (line 590) | static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
  function add_value (line 612) | static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
  function str_gsub (line 644) | static int str_gsub (lua_State *L) {
  function addquoted (line 696) | static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
  function addintlen (line 747) | static void addintlen (char *form) {
  function str_format (line 756) | static int str_format (lua_State *L) {
  function createmetatable (line 845) | static void createmetatable (lua_State *L) {
  function LUALIB_API (line 860) | LUALIB_API int luaopen_string (lua_State *L) {

FILE: src/ltable.c
  function Node (line 84) | static Node *hashnum (const Table *t, lua_Number n) {
  function Node (line 100) | static Node *mainposition (const Table *t, const TValue *key) {
  function arrayindex (line 120) | static int arrayindex (const TValue *key) {
  function findindex (line 137) | static int findindex (lua_State *L, Table *t, StkId key) {
  function luaH_next (line 162) | int luaH_next (lua_State *L, Table *t, StkId key) {
  function computesizes (line 189) | static int computesizes (int nums[], int *narray) {
  function countint (line 211) | static int countint (const TValue *key, int *nums) {
  function numusearray (line 222) | static int numusearray (const Table *t, int *nums) {
  function numusehash (line 247) | static int numusehash (const Table *t, int *nums, int *pnasize) {
  function setarrayvector (line 263) | static void setarrayvector (lua_State *L, Table *t, int size) {
  function Node (line 272) | static Node *getfreepos (Table *t) {
  function resizenodevector (line 281) | static void resizenodevector (lua_State *L, Table *t, int oldsize, int n...
  function Node (line 312) | static Node *find_prev_node(Node *mp, Node *next) {
  function move_node (line 326) | static int move_node (lua_State *L, Table *t, Node *node) {
  function move_number (line 365) | static int move_number (lua_State *L, Table *t, Node *node) {
  function resize_hashpart (line 383) | static void resize_hashpart (lua_State *L, Table *t, int nhsize) {
  function resize (line 436) | static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
  function luaH_resizearray (line 455) | void luaH_resizearray (lua_State *L, Table *t, int nasize) {
  function rehash (line 461) | static void rehash (lua_State *L, Table *t, const TValue *ek) {
  function Table (line 486) | Table *luaH_new (lua_State *L, int narray, int nhash) {
  function luaH_free (line 505) | void luaH_free (lua_State *L, Table *t) {
  function TValue (line 521) | static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
  function TValue (line 557) | const TValue *luaH_getnum (Table *t, int key) {
  function TValue (line 577) | const TValue *luaH_getstr (Table *t, TString *key) {
  function TValue (line 591) | const TValue *luaH_get (Table *t, const TValue *key) {
  function TValue (line 616) | TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
  function TValue (line 630) | TValue *luaH_setnum (lua_State *L, Table *t, int key) {
  function TValue (line 642) | TValue *luaH_setstr (lua_State *L, Table *t, TString *key) {
  function unbound_search (line 654) | static int unbound_search (Table *t, unsigned int j) {
  function luaH_getn (line 682) | int luaH_getn (Table *t) {
  function Node (line 704) | Node *luaH_mainposition (const Table *t, const TValue *key) {
  function luaH_isdummy (line 708) | int luaH_isdummy (Node *n) { return n == dummynode; }

FILE: src/ltablib.c
  function foreachi (line 22) | static int foreachi (lua_State *L) {
  function foreach (line 39) | static int foreach (lua_State *L) {
  function maxn (line 56) | static int maxn (lua_State *L) {
  function getn (line 72) | static int getn (lua_State *L) {
  function setn (line 78) | static int setn (lua_State *L) {
  function tinsert (line 90) | static int tinsert (lua_State *L) {
  function tremove (line 118) | static int tremove (lua_State *L) {
  function addfield (line 135) | static void addfield (lua_State *L, luaL_Buffer *b, int i) {
  function tconcat (line 144) | static int tconcat (lua_State *L) {
  function set2 (line 173) | static void set2 (lua_State *L, int i, int j) {
  function sort_comp (line 178) | static int sort_comp (lua_State *L, int a, int b) {
  function auxsort (line 193) | static void auxsort (lua_State *L, int l, int u) {
  function sort (line 256) | static int sort (lua_State *L) {
  function LUALIB_API (line 283) | LUALIB_API int luaopen_table (lua_State *L) {

FILE: src/ltm.c
  function luaT_init (line 30) | void luaT_init (lua_State *L) {
  function TValue (line 50) | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
  function TValue (line 61) | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {

FILE: src/ltm.h
  type TMS (line 18) | typedef enum {

FILE: src/lua.c
  function lstop (line 28) | static void lstop (lua_State *L, lua_Debug *ar) {
  function laction (line 35) | static void laction (int i) {
  function print_usage (line 42) | static void print_usage (void) {
  function l_message (line 59) | static void l_message (const char *pname, const char *msg) {
  function report (line 66) | static int report (lua_State *L, int status) {
  function traceback (line 77) | static int traceback (lua_State *L) {
  function docall (line 97) | static int docall (lua_State *L, int narg, int clear) {
  function print_version (line 112) | static void print_version (void) {
  function getargs (line 117) | static int getargs (lua_State *L, char **argv, int n) {
  function dofile (line 135) | static int dofile (lua_State *L, const char *name) {
  function dostring (line 141) | static int dostring (lua_State *L, const char *s, const char *name) {
  function dolibrary (line 147) | static int dolibrary (lua_State *L, const char *name) {
  function incomplete (line 164) | static int incomplete (lua_State *L, int status) {
  function pushline (line 178) | static int pushline (lua_State *L, int firstline) {
  function loadline (line 197) | static int loadline (lua_State *L) {
  function dotty (line 217) | static void dotty (lua_State *L) {
  function handle_script (line 240) | static int handle_script (lua_State *L, char **argv, int n) {
  function collectargs (line 262) | static int collectargs (char **argv, int *pi, int *pv, int *pe) {
  function runargs (line 296) | static int runargs (lua_State *L, char **argv, int n) {
  function handle_luainit (line 334) | static int handle_luainit (lua_State *L) {
  type Smain (line 344) | struct Smain {
  function pmain (line 351) | static int pmain (lua_State *L) {
  function main (line 388) | int main (int argc, char **argv) {

FILE: src/lua.h
  type lua_State (line 50) | typedef struct lua_State lua_State;
  type TValue (line 51) | typedef struct lua_TValue TValue;
  type TValue (line 52) | typedef TValue *StkId;
  type LUA_NUMBER (line 102) | typedef LUA_NUMBER lua_Number;
  type LUA_INTEGER (line 106) | typedef LUA_INTEGER lua_Integer;
  type lua_Debug (line 331) | typedef struct lua_Debug lua_Debug;
  type lua_Debug (line 351) | struct lua_Debug {

FILE: src/luac.c
  function fatal (line 36) | static void fatal(const char* message)
  function cannot (line 42) | static void cannot(const char* what)
  function usage (line 48) | static void usage(const char* message)
  function doargs (line 70) | static int doargs(int argc, char* argv[])
  function Proto (line 119) | static const Proto* combine(lua_State* L, int n)
  function writer (line 147) | static int writer(lua_State* L, const void* p, size_t size, void* u)
  type Smain (line 153) | struct Smain {
  function pmain (line 158) | static int pmain(lua_State* L)
  function main (line 186) | int main(int argc, char* argv[])

FILE: src/lundump.c
  type LoadState (line 23) | typedef struct {
  function error (line 36) | static void error(LoadState* S, const char* why)
  function LoadBlock (line 48) | static void LoadBlock(LoadState* S, void* b, size_t size)
  function LoadChar (line 54) | static int LoadChar(LoadState* S)
  function LoadInt (line 61) | static int LoadInt(LoadState* S)
  function lua_Number (line 69) | static lua_Number LoadNumber(LoadState* S)
  function TString (line 76) | static TString* LoadString(LoadState* S)
  function LoadCode (line 90) | static void LoadCode(LoadState* S, Proto* f)
  function LoadConstants (line 100) | static void LoadConstants(LoadState* S, Proto* f)
  function LoadDebug (line 137) | static void LoadDebug(LoadState* S, Proto* f)
  function Proto (line 161) | static Proto* LoadFunction(LoadState* S, TString* p)
  function LoadHeader (line 183) | static void LoadHeader(LoadState* S)
  function Proto (line 195) | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
  function luaU_header (line 214) | void luaU_header (char* h)

FILE: src/lvm.c
  function TValue (line 35) | const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
  function luaV_tostring (line 47) | int luaV_tostring (lua_State *L, StkId obj) {
  function luaV_traceexec (line 61) | void luaV_traceexec (lua_State *L, const Instruction *pc) {
  function callTMres (line 81) | static void callTMres (lua_State *L, StkId res, const TValue *f,
  function callTM (line 97) | static void callTM (lua_State *L, const TValue *f, const TValue *p1,
  function luaV_gettable (line 109) | void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId va...
  function luaV_settable (line 135) | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId va...
  function luaV_call_binTM (line 173) | int luaV_call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
  function TValue (line 184) | static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
  function call_orderTM (line 198) | static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
  function l_strcmp (line 211) | static int l_strcmp (const TString *ls, const TString *rs) {
  function luaV_lessthan (line 233) | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
  function luaV_lessequal (line 247) | int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
  function luaV_equalval (line 263) | int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
  function luaV_concat (line 290) | void luaV_concat (lua_State *L, int total, int last) {
  function luaV_arith (line 334) | void luaV_arith (lua_State *L, StkId ra, const TValue *rb,
  function luaV_execute (line 399) | void luaV_execute (lua_State *L, int nexeccalls) {

FILE: src/lzio.c
  function luaZ_fill (line 21) | int luaZ_fill (ZIO *z) {
  function luaZ_lookahead (line 35) | int luaZ_lookahead (ZIO *z) {
  function luaZ_init (line 48) | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
  function luaZ_read (line 58) | size_t luaZ_read (ZIO *z, void *b, size_t n) {

FILE: src/lzio.h
  type ZIO (line 18) | typedef struct Zio ZIO;
  type Mbuffer (line 24) | typedef struct Mbuffer {
  type Zio (line 56) | struct Zio {

FILE: src/print.c
  function PrintString (line 23) | static void PrintString(const TString* ts)
  function PrintConstant (line 51) | static void PrintConstant(const Proto* f, int i)
  function PrintCode (line 74) | static void PrintCode(const Proto* f)
  function PrintHeader (line 161) | static void PrintHeader(const Proto* f)
  function PrintConstants (line 181) | static void PrintConstants(const Proto* f)
  function PrintLocals (line 193) | static void PrintLocals(const Proto* f)
  function PrintUpvalues (line 204) | static void PrintUpvalues(const Proto* f)
  function PrintFunction (line 215) | void PrintFunction(const Proto* f, int full)
Condensed preview — 180 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,257K chars).
[
  {
    "path": ".gitignore",
    "chars": 117,
    "preview": "build\nllvm-lua/*.bc\nllvm-lua/*_bc.h\nsrc/.libs\nsrc/*.o\nsrc/*.lo\nsrc/*.la\nsrc/*.a\nsrc/lua\nsrc/luac\nsrc/lua_test\n.*.swp\n"
  },
  {
    "path": ".hgignore",
    "chars": 84,
    "preview": "# Backup files\n.*~$\n# Rejected patches\n.*\\.orig$\n.*\\.rej$\n# Build directory\n^build$\n"
  },
  {
    "path": "AUTHORS",
    "chars": 68,
    "preview": "bobby@neoawareness.com:Robert G. Jakabosky <bobby@neoawareness.com>\n"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 11028,
    "preview": "#\n# llvm-lua\n#\ncmake_minimum_required(VERSION 2.4 FATAL_ERROR)\n\nif(COMMAND cmake_policy)\n  cmake_policy(SET CMP0003 NEW)"
  },
  {
    "path": "COPYRIGHT",
    "chars": 1528,
    "preview": "Lua License\n-----------\n\nLua is licensed under the terms of the MIT license reproduced below.\nThis means that Lua is fre"
  },
  {
    "path": "ChangeLog",
    "chars": 22762,
    "preview": "2009-11-05  Robert G. Jakabosky <bobby@neoawareness.com>\n\n\t* llvm-lua/CMakeLists.txt, llvm-lua/run_tests.sh, src/ldo.c,\n"
  },
  {
    "path": "HISTORY",
    "chars": 7907,
    "preview": "HISTORY for Lua 5.1\n\n* Changes from version 5.0 to 5.1\n  -------------------------------\n  Language:\n  + new module syst"
  },
  {
    "path": "INSTALL",
    "chars": 3868,
    "preview": "INSTALL for Lua 5.1\n\n* Building Lua\n  ------------\n  Lua is built in the src directory, but the build process can be\n  c"
  },
  {
    "path": "README",
    "chars": 1378,
    "preview": "README for Lua 5.1\n\nSee INSTALL for installation instructions.\nSee HISTORY for a summary of changes since the last relea"
  },
  {
    "path": "README.llvm-lua",
    "chars": 2708,
    "preview": "README for llvm-lua\n\n=== Requires ===\n * LLVM 2.8\n * Clang or llvm-gcc 4.2.x from llvm.org\n\n=== Compile ===\n * mkdir bui"
  },
  {
    "path": "TODO",
    "chars": 792,
    "preview": "-- TODO list\n\nmisc:\n* Port lua-compiler bash script to a Lua script.\n* handle coroutine c-stack alignment issues on x86_"
  },
  {
    "path": "cmake/CustomMacros.cmake",
    "chars": 1594,
    "preview": "\nmacro(add_llvm_bc_library _target)\n\tset(_llvm_cflags)\n\tget_property(_idirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)\n\tfor"
  },
  {
    "path": "cmake/FindLLVM.cmake",
    "chars": 874,
    "preview": "# - Find libev\n# Find the native LLVM includes and library\n#\n#  LLVM_INCLUDE_DIR - where to find ev.h, etc.\n#  LLVM_LIBR"
  },
  {
    "path": "cmake_uninstall.cmake.in",
    "chars": 712,
    "preview": "IF(NOT EXISTS \"@CMAKE_BINARY_DIR@/install_manifest.txt\")\n  MESSAGE(FATAL_ERROR \"Cannot find install manifest: \\\"@CMAKE_B"
  },
  {
    "path": "doc/contents.html",
    "chars": 22252,
    "preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<HTML>\n<HEAD>\n<TITLE>Lua 5.1 Reference Manual - contents"
  },
  {
    "path": "doc/lua.1",
    "chars": 3619,
    "preview": ".\\\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $\n.TH LUA 1 \"$Date: 2006/01/06 16:03:34 $\"\n.SH NAME\nlua \\- Lua inter"
  },
  {
    "path": "doc/lua.css",
    "chars": 588,
    "preview": "body {\n\tcolor: #000000 ;\n\tbackground-color: #FFFFFF ;\n\tfont-family: sans-serif ;\n\ttext-align: justify ;\n\tmargin-right: 2"
  },
  {
    "path": "doc/lua.html",
    "chars": 3951,
    "preview": "<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->\n<HTML>\n<HEAD>\n<TITLE>LUA man page</TITLE>\n<LINK REL=\"styleshe"
  },
  {
    "path": "doc/luac.1",
    "chars": 3617,
    "preview": ".\\\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $\n.TH LUAC 1 \"$Date: 2006/01/06 16:03:34 $\"\n.SH NAME\nluac \\- Lua co"
  },
  {
    "path": "doc/luac.html",
    "chars": 3896,
    "preview": "<!-- $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -->\n<HTML>\n<HEAD>\n<TITLE>LUAC man page</TITLE>\n<LINK REL=\"styles"
  },
  {
    "path": "doc/manual.css",
    "chars": 120,
    "preview": "h3 code {\n\tfont-family: inherit ;\n}\n\npre {\n\tfont-size: 105% ;\n}\n\nspan.apii {\n\tfloat: right ;\n\tfont-family: inherit ;\n}\n\n"
  },
  {
    "path": "doc/manual.html",
    "chars": 254624,
    "preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n\n<head>\n<title>Lua 5.1 Reference Manual</title>\n<"
  },
  {
    "path": "doc/readme.html",
    "chars": 833,
    "preview": "<HTML>\n<HEAD>\n<TITLE>Lua documentation</TITLE>\n<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"lua.css\">\n</HEAD>\n\n<BODY>\n\n<"
  },
  {
    "path": "etc/README",
    "chars": 972,
    "preview": "This directory contains some useful files and code.\nUnlike the code in ../src, everything here is in the public domain.\n"
  },
  {
    "path": "etc/all.c",
    "chars": 678,
    "preview": "/*\n* all.c -- Lua core, libraries and interpreter in a single file\n*/\n\n#define luaall_c\n\n#include \"lapi.c\"\n#include \"lco"
  },
  {
    "path": "etc/embed_jit.c",
    "chars": 873,
    "preview": "/*\n* min.c -- a minimal Lua interpreter\n* loads stdin only with minimal error handling.\n* no interaction, and no standar"
  },
  {
    "path": "etc/embed_jit.cpp",
    "chars": 888,
    "preview": "/*\n* min.c -- a minimal Lua interpreter\n* loads stdin only with minimal error handling.\n* no interaction, and no standar"
  },
  {
    "path": "etc/lua.hpp",
    "chars": 191,
    "preview": "// lua.hpp\n// Lua header files for C++\n// <<extern \"C\">> not supplied automatically because Lua also compiles as C++\n\nex"
  },
  {
    "path": "etc/lua.pc",
    "chars": 755,
    "preview": "# lua.pc -- pkg-config data for Lua\n\n# vars from install Makefile\n\n# grep '^V=' ../Makefile\nV= 5.1\n# grep '^R=' ../Makef"
  },
  {
    "path": "etc/luavs.bat",
    "chars": 1070,
    "preview": "@rem Script to build Lua under \"Visual Studio .NET Command Prompt\".\r\n@rem Do not run from this directory; run it from th"
  },
  {
    "path": "etc/min.c",
    "chars": 800,
    "preview": "/*\n* min.c -- a minimal Lua interpreter\n* loads stdin only with minimal error handling.\n* no interaction, and no standar"
  },
  {
    "path": "etc/noparser.c",
    "chars": 1253,
    "preview": "/*\n* The code below can be used to make a Lua core that does not contain the\n* parsing modules (lcode, llex, lparser), w"
  },
  {
    "path": "etc/strict.lua",
    "chars": 928,
    "preview": "--\n-- strict.lua\n-- checks uses of undeclared global variables\n-- All global variables must be 'declared' through a regu"
  },
  {
    "path": "gen_changelog.sh",
    "chars": 86,
    "preview": "#!/bin/sh\n#\n\nsvn2cl --authors=AUTHORS --break-before-msg --group-by-day -o ChangeLog\n\n"
  },
  {
    "path": "llvm-lua/CMakeLists.txt",
    "chars": 11644,
    "preview": "\n#\n# llvm-lua source\n#\nset(NON_LLVM_SRC\n\tlua_core.c\n\tlua_vm_ops_static.c\n\tload_jit_proto.c\n)\nset(LLVM_COMMON_SRC\n\tLLVMCo"
  },
  {
    "path": "llvm-lua/COPYRIGHT.llvm-lua",
    "chars": 1129,
    "preview": "Copyright (c) 2008 Robert G. Jakabosky\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof "
  },
  {
    "path": "llvm-lua/LLVMCompiler.cpp",
    "chars": 41895,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/LLVMCompiler.h",
    "chars": 4454,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/LLVMDumper.cpp",
    "chars": 20349,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/LLVMDumper.h",
    "chars": 2716,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/TODO",
    "chars": 292,
    "preview": "\noptimizations:\n* When the internal index/limit/step variable of a OP_FORLOOP get moved to the C-Stack the space on the "
  },
  {
    "path": "llvm-lua/bin2c.c",
    "chars": 2306,
    "preview": "/*\n * bin2c.c\n *\n * convert a binary file into a C source vector\n *\n * THE \"BEER-WARE LICENSE\" (Revision 3.1415):\n * san"
  },
  {
    "path": "llvm-lua/compile_all.sh",
    "chars": 299,
    "preview": "#!/usr/bin/env bash\n#\n\nOPTS=\"\"\nFILES=\"\"\n# parse command line parameters.\nfor arg in \"$@\" ; do\n\tcase \"$arg\" in\n\t-*) OPTS="
  },
  {
    "path": "llvm-lua/hook_parser.c",
    "chars": 4112,
    "preview": "/*\n** See Copyright Notice in lua.h\n*/\n\n/*\n* hook_parser.c - Add a hook to the parser in ldo.c\n*\n* Most of this code is "
  },
  {
    "path": "llvm-lua/llvm-lua.cpp",
    "chars": 4917,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n\n  Permission is hereby granted, free of charge, to any person obtaining a c"
  },
  {
    "path": "llvm-lua/llvm-luac.cpp",
    "chars": 5388,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n\n  Permission is hereby granted, free of charge, to any person obtaining a c"
  },
  {
    "path": "llvm-lua/llvm_compiler.cpp",
    "chars": 2593,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/llvm_compiler.h",
    "chars": 1782,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n\n  Permission is hereby granted, free of charge, to any person obtaining a c"
  },
  {
    "path": "llvm-lua/llvm_compiler_private.h",
    "chars": 1365,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/llvm_dumper.cpp",
    "chars": 1586,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/llvm_dumper.h",
    "chars": 1425,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/llvm_lmathlib.c",
    "chars": 8012,
    "preview": "/*\n** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $\n** Standard mathematical library\n** See Copyright Not"
  },
  {
    "path": "llvm-lua/llvm_lua_config.h.in",
    "chars": 165,
    "preview": "#ifndef llvm_config_h\n#define llvm_config_h\n\n#define LLVM_LUA_VERSION \"@LLVM_LUA_NAME@ @LLVM_LUA_VERSION@\"\n#define LLVM_"
  },
  {
    "path": "llvm-lua/load_embedded_bc.cpp",
    "chars": 2265,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/load_jit_proto.c",
    "chars": 4483,
    "preview": "/*\n\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "llvm-lua/load_jit_proto.h",
    "chars": 2804,
    "preview": "/*\n  load_jit_proto.h -- load jit proto\n\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, fre"
  },
  {
    "path": "llvm-lua/load_liblua_main.cpp",
    "chars": 1544,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/load_liblua_main.h",
    "chars": 1330,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/load_vm_ops.cpp",
    "chars": 1530,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/load_vm_ops.h",
    "chars": 1315,
    "preview": "/*\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining a"
  },
  {
    "path": "llvm-lua/lua-compiler.in",
    "chars": 4361,
    "preview": "#!/usr/bin/env bash\n#\n\n# path to lua-compiler\nDIR=`realpath $0`\nDIR=`dirname $DIR`\n\nCC=clang\nLIBTOOL=\"libtool --tag=CC -"
  },
  {
    "path": "llvm-lua/lua-cross-compiler.in",
    "chars": 3614,
    "preview": "#!/usr/bin/env bash\n#\n\n# path to lua-cross-compiler\nDIR=`realpath $0`\nDIR=`dirname $DIR`\n\nCC=@CROSS_TRIPLE@-gcc\nLLVM_LUA"
  },
  {
    "path": "llvm-lua/lua_compiler.c",
    "chars": 8903,
    "preview": "/*\n** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $\n** Lua compiler (saves bytecodes to files; also list bytecodes)\n*"
  },
  {
    "path": "llvm-lua/lua_compiler.h",
    "chars": 194,
    "preview": "\n#ifndef lua_compiler_h\n#define lua_compiler_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"lua_core.h\"\n\nextern in"
  },
  {
    "path": "llvm-lua/lua_core.c",
    "chars": 2485,
    "preview": "/*\n  lua_core.c -- Lua core, libraries and JIT hooks compiled into a single file\n\n  Copyright (c) 2009 Robert G. Jakabos"
  },
  {
    "path": "llvm-lua/lua_core.h",
    "chars": 565,
    "preview": "\n#ifndef lua_core_h\n#define lua_core_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define lua_c\n#define loslib_c\n#define L"
  },
  {
    "path": "llvm-lua/lua_interpreter.c",
    "chars": 276,
    "preview": "/*\n * lua_interpreter.c -- Lua interpreter\n */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"lua_core.h\"\n#include \""
  },
  {
    "path": "llvm-lua/lua_interpreter.h",
    "chars": 176,
    "preview": "\n#ifndef lua_interpreter_h\n#define lua_interpreter_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nextern int lua_main(int ar"
  },
  {
    "path": "llvm-lua/lua_main.c",
    "chars": 4769,
    "preview": "/*\n** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $\n** Lua stand-alone interpreter\n** See Copyright Notice in"
  },
  {
    "path": "llvm-lua/lua_normal.c",
    "chars": 815,
    "preview": "/*\n** See Copyright Notice in lua.h\n*/\n\n/*\n * lua_normal.c -- Lua core, libraries and interpreter in a single file\n */\n\n"
  },
  {
    "path": "llvm-lua/lua_vm_ops.c",
    "chars": 11731,
    "preview": "/*\n** See Copyright Notice in lua.h\n*/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * lua_vm_ops.c -- Lua ops functions "
  },
  {
    "path": "llvm-lua/lua_vm_ops.h",
    "chars": 8016,
    "preview": "\n#ifndef lua_vm_ops_h\n#define lua_vm_ops_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"lua_core.h\"\n#include \"lobj"
  },
  {
    "path": "llvm-lua/lua_vm_ops_static.c",
    "chars": 20819,
    "preview": "/*\n** See Copyright Notice in lua.h\n*/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * lua_vm_ops.c -- Lua ops functions "
  },
  {
    "path": "llvm-lua/no_jit.c",
    "chars": 2076,
    "preview": "/*\n\n  Copyright (c) 2009 Robert G. Jakabosky\n  \n  Permission is hereby granted, free of charge, to any person obtaining "
  },
  {
    "path": "llvm-lua/run_tests.sh",
    "chars": 230,
    "preview": "#!/bin/sh\n#\n\nfor script in `ls tests/*.lua`; do\n\techo \"run test: $script\"\n\tllvm-lua -g -O0 $script >/dev/null || {\n\t\tech"
  },
  {
    "path": "llvm-lua/tests/NOTES",
    "chars": 159,
    "preview": "Some of these scripts are pieces from other scripts that have exposed bugs\nin past versions of llvm-lua.\n\nThese scripts "
  },
  {
    "path": "llvm-lua/tests/add.lua",
    "chars": 109,
    "preview": "local a = \"1\" + 2\nlocal b = 1\nlocal c = 2\nlocal d = b + 2\nlocal e = 1 + c\nlocal f = b + c\nprint(a,b,c,d,e,f)\n"
  },
  {
    "path": "llvm-lua/tests/arg_test.lua",
    "chars": 78,
    "preview": "print(unpack(arg))\nlocal n = tonumber((arg and arg[1]) or 1)\nio.write(n,\"\\n\")\n"
  },
  {
    "path": "llvm-lua/tests/big_table.lua",
    "chars": 60638,
    "preview": "local q = {\n1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,\n1,2,3,4"
  },
  {
    "path": "llvm-lua/tests/coroutine.lua",
    "chars": 958,
    "preview": "-- coroutine tests\n\nlocal f\n\nassert(coroutine.running() == nil)\n\n\n-- tests for global environment\n\nlocal function foo (a"
  },
  {
    "path": "llvm-lua/tests/dump.lua",
    "chars": 145,
    "preview": "local function test()\n\tlocal v=\"test\"\n\tlocal function test2()\n\t\tprint(v)\n\tend\n\ttest2()\n\treturn\nend\n\nlocal d=string.dump("
  },
  {
    "path": "llvm-lua/tests/for.lua",
    "chars": 200,
    "preview": "local n = tonumber((arg and arg[1]) or 1)\nlocal hash1={}\nfor i=0,10000 do\n    hash1[\"foo_\"..i] = i\n    hash1[i] = i\nend\n"
  },
  {
    "path": "llvm-lua/tests/hash2.lua",
    "chars": 411,
    "preview": "local n = tonumber((arg and arg[1]) or 1)\n\nlocal hash1={}\nfor i=0,10000 do\n    hash1[\"foo_\"..i] = i\nend\nlocal hash2={}\nf"
  },
  {
    "path": "llvm-lua/tests/loadk.lua",
    "chars": 3205,
    "preview": "local function test_loadk()\nlocal q = {\n1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,"
  },
  {
    "path": "llvm-lua/tests/local_nil.lua",
    "chars": 407,
    "preview": "--[[\nlocal function min_stack()\nend\nlocal function min_stack_params(a,b,c,d,e)\nend\nlocal function tail_recursive_nil(dep"
  },
  {
    "path": "llvm-lua/tests/loops.lua",
    "chars": 256,
    "preview": "\nlocal x = 0\nfor a=1,25 do\n\tx = x + 1\nend\nfor b=1,25 do\n\tx = x + 1\nend\nfor c=1,25 do\n\tx = x + 1\nend\nfor d=1,25 do\n\tx = x"
  },
  {
    "path": "llvm-lua/tests/lua_tail.lua",
    "chars": 60760,
    "preview": "local function lua_tail()\nlocal q = {\n1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,"
  },
  {
    "path": "llvm-lua/tests/nestedloop.lua",
    "chars": 359,
    "preview": "local x = 0\nlocal x2 = 0\nfor a=1,25 do\n\tfor b=1,25 do\n\t\tfor c=1,25 do\n\t\t\tfor d=1,25 do\n\t\t\t\tfor e=1,25 do\n\t\t\t\t\tfor f=1,25"
  },
  {
    "path": "llvm-lua/tests/nestedloop2.lua",
    "chars": 306,
    "preview": "local x = 0\nfor a=25,1,-1 do\n\tfor b=25,1,-1 do\n\t\tfor c=25,1,-1 do\n\t\t\tfor d=25,1,-1 do\n\t\t\t\tfor e=25,1,-1 do\n\t\t\t\t\tfor f=25"
  },
  {
    "path": "llvm-lua/tests/nums.lua",
    "chars": 98,
    "preview": "local a=5\nlocal b=6\nlocal c=7\nlocal d=8\na = a + 9\nb = b - 10\nc = c * 11\nd = d / 12\nprint(a,b,c,d)\n"
  },
  {
    "path": "llvm-lua/tests/scimark_loop.lua",
    "chars": 87,
    "preview": "\nlocal n = 100\nlocal test = function()\n\t\tfor i=1,n*2 do\nprint(i)\n\t\tend\nend\n\ntest(100)\n\n"
  },
  {
    "path": "llvm-lua/tests/scimark_rand.lua",
    "chars": 680,
    "preview": "--\n-- This script dies at the assert if compiled using the following commands:\n-- 1. llvm-luac -O0 -no-main -bc -o scima"
  },
  {
    "path": "llvm-lua/tests/stress_for.lua",
    "chars": 167,
    "preview": "local width = 100\nlocal xb = 50\nlocal a = 0\n\nfor x=0, xb < width and 10 or 20 do\n\ta = a + 1\nend\n\nfor x=xb < width and 10"
  },
  {
    "path": "llvm-lua/tests/test.lua",
    "chars": 82,
    "preview": "\nlocal i\nlocal count=0\n\nfor i=1,100000000 do\n\tcount = count + 1\nend\n\nprint(count)\n"
  },
  {
    "path": "llvm-lua/tests/test2.lua",
    "chars": 208,
    "preview": "function f(x,y,z)\n        print(\"hook\",x,y,z)\nend\n\nfunction g()\n        print\"0\"\n        debug.sethook(f,\"l\")\n        pr"
  },
  {
    "path": "llvm-lua/tests/test3.lua",
    "chars": 430,
    "preview": "debug.sethook(function(e,l,x) print(e,l,x) end, \"l\")\n\n-- very inefficient fibonacci function\nfunction fib(n)\n\tN=N+1\n\tif "
  },
  {
    "path": "llvm-lua/tests/test4.lua",
    "chars": 78,
    "preview": "local a = 1\nlocal b = 2\nlocal c\nif a > b then\n\tc = a\nelse\n\tc = b\nend\nprint(c)\n"
  },
  {
    "path": "llvm-lua/tests/test_lineerror.lua",
    "chars": 648,
    "preview": "-- testing line error\n\nfunction lineerror (s)\n  local err,msg = pcall(loadstring(s))\n  local line = string.match(msg, \":"
  },
  {
    "path": "llvm-lua/tests/test_math.lua",
    "chars": 840,
    "preview": "\nlocal sqrt=math.sqrt\nlocal a\n\nfor n=1,1000000 do\n--for n=1,10000 do\n\ta=sqrt(9)\n\ta=sqrt(9)\n\ta=sqrt(9)\n\ta=sqrt(9)\n\ta=sqrt"
  },
  {
    "path": "llvm-lua/tests/test_tail.lua",
    "chars": 230,
    "preview": "local function tail(depth)\n\tif(depth > 0) then\n\t\treturn tail(depth - 1)\n\tend\n\treturn 0\nend\n\nlocal N = tonumber(arg and a"
  },
  {
    "path": "llvm-lua/tests/test_tail_nil_multret.lua",
    "chars": 249,
    "preview": "do\n\tlocal f = function(n)\n\t\tlocal x = {}\n\t\tfor i=1,n do\n\t\t\tx[i] = i\n\t\tend\n\t\treturn unpack(x)\n\tend\n\n\tlocal a,b,c\n\ta,b,c ="
  },
  {
    "path": "llvm-lua/tests/test_varg_tail2.lua",
    "chars": 143,
    "preview": "function tail_cfunc(...)\n\tlocal s = string.format(...)\n\treturn print(s)\nend\n\nprint(tail_cfunc(\"this is a test: %s %s %s "
  },
  {
    "path": "src/lapi.c",
    "chars": 23701,
    "preview": "/*\n** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $\n** Lua API\n** See Copyright Notice in lua.h\n*/\n\n\n#include"
  },
  {
    "path": "src/lapi.h",
    "chars": 262,
    "preview": "/*\n** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Lua API\n** See Copyright Notic"
  },
  {
    "path": "src/lauxlib.c",
    "chars": 19954,
    "preview": "/*\n** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** "
  },
  {
    "path": "src/lauxlib.h",
    "chars": 6134,
    "preview": "/*\n** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** S"
  },
  {
    "path": "src/lbaselib.c",
    "chars": 17716,
    "preview": "/*\n** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $\n** Basic library\n** See Copyright Notice in lua.h\n*/"
  },
  {
    "path": "src/lcoco.c",
    "chars": 23794,
    "preview": "/*\n** Copyright (C) 2004-2012 Mike Pall. All rights reserved.\n**\n** Permission is hereby granted, free of charge, to any"
  },
  {
    "path": "src/lcoco.h",
    "chars": 2349,
    "preview": "/*\n** Lua/Coco glue.\n** Copyright (C) 2004-2012 Mike Pall. See copyright notice in lcoco.c\n*/\n\n#ifndef lcoco_h\n#define l"
  },
  {
    "path": "src/lcode.c",
    "chars": 21467,
    "preview": "/*\n** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua"
  },
  {
    "path": "src/lcode.h",
    "chars": 2750,
    "preview": "/*\n** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua"
  },
  {
    "path": "src/ldblib.c",
    "chars": 10092,
    "preview": "/*\n** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $\n** Interface from Lua to its debug API\n** See Copyrigh"
  },
  {
    "path": "src/ldebug.c",
    "chars": 17192,
    "preview": "/*\n** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $\n** Debug Interface\n** See Copyright Notice in lua.h\n*/\n"
  },
  {
    "path": "src/ldebug.h",
    "chars": 1064,
    "preview": "/*\n** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Debug Interface module\n** Se"
  },
  {
    "path": "src/ldo.c",
    "chars": 15418,
    "preview": "/*\n** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice"
  },
  {
    "path": "src/ldo.h",
    "chars": 2239,
    "preview": "/*\n** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice "
  },
  {
    "path": "src/ldump.c",
    "chars": 3114,
    "preview": "/*\n** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** save precompiled Lua chunks\n** See Copyright Notice in"
  },
  {
    "path": "src/lfunc.c",
    "chars": 4746,
    "preview": "/*\n** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $\n** Auxiliary functions to manipulate prototypes and clos"
  },
  {
    "path": "src/lfunc.h",
    "chars": 1125,
    "preview": "/*\n** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closu"
  },
  {
    "path": "src/lgc.c",
    "chars": 20680,
    "preview": "/*\n** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "src/lgc.h",
    "chars": 3952,
    "preview": "/*\n** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "src/linit.c",
    "chars": 765,
    "preview": "/*\n** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $\n** Initialization of libraries for lua.c\n** See Copyrigh"
  },
  {
    "path": "src/liolib.c",
    "chars": 13406,
    "preview": "/*\n** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $\n** Standard I/O (and system) library\n** See Copyright N"
  },
  {
    "path": "src/llex.c",
    "chars": 12474,
    "preview": "/*\n** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "src/llex.h",
    "chars": 2177,
    "preview": "/*\n** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "src/llimits.h",
    "chars": 2349,
    "preview": "/*\n** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $\n** Limits, basic types, and some other `installation-d"
  },
  {
    "path": "src/lmathlib.c",
    "chars": 5831,
    "preview": "/*\n** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $\n** Standard mathematical library\n** See Copyright Not"
  },
  {
    "path": "src/lmem.c",
    "chars": 2172,
    "preview": "/*\n** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in"
  },
  {
    "path": "src/lmem.h",
    "chars": 1494,
    "preview": "/*\n** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in"
  },
  {
    "path": "src/loadlib.c",
    "chars": 19504,
    "preview": "/*\n** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $\n** Dynamic library loader for Lua\n** See Copyright Not"
  },
  {
    "path": "src/lobject.c",
    "chars": 5498,
    "preview": "/*\n** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $\n** Some generic functions over Lua objects\n** See Copy"
  },
  {
    "path": "src/lobject.h",
    "chars": 8686,
    "preview": "/*\n** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $\n** Type definitions for Lua objects\n** See Copyright N"
  },
  {
    "path": "src/lopcodes.c",
    "chars": 2884,
    "preview": "/*\n** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $\n** See Copyright Notice in lua.h\n*/\n\n\n#define lopcode"
  },
  {
    "path": "src/lopcodes.h",
    "chars": 8086,
    "preview": "/*\n** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $\n** Opcodes for Lua virtual machine\n** See Copyright "
  },
  {
    "path": "src/loslib.c",
    "chars": 5992,
    "preview": "/*\n** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $\n** Standard Operating System library\n** See Copyright N"
  },
  {
    "path": "src/lparser.c",
    "chars": 36696,
    "preview": "/*\n** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n\n#i"
  },
  {
    "path": "src/lparser.h",
    "chars": 2261,
    "preview": "/*\n** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n#if"
  },
  {
    "path": "src/lstate.c",
    "chars": 5869,
    "preview": "/*\n** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n\n#"
  },
  {
    "path": "src/lstate.h",
    "chars": 5215,
    "preview": "/*\n** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n#i"
  },
  {
    "path": "src/lstring.c",
    "chars": 3251,
    "preview": "/*\n** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** String table (keeps all strings handled by Lua)\n** S"
  },
  {
    "path": "src/lstring.h",
    "chars": 814,
    "preview": "/*\n** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $\n** String table (keep all strings handled by Lua)\n** S"
  },
  {
    "path": "src/lstrlib.c",
    "chars": 23481,
    "preview": "/*\n** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $\n** Standard library for string operations and pattern"
  },
  {
    "path": "src/ltable.c",
    "chars": 20433,
    "preview": "/*\n** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*"
  },
  {
    "path": "src/ltable.h",
    "chars": 1184,
    "preview": "/*\n** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua tables (hash)\n** See Copyright Notice in lua.h\n*"
  },
  {
    "path": "src/ltablib.c",
    "chars": 7343,
    "preview": "/*\n** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $\n** Library for Table Manipulation\n** See Copyright Not"
  },
  {
    "path": "src/ltm.c",
    "chars": 1650,
    "preview": "/*\n** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n\n#inclu"
  },
  {
    "path": "src/ltm.h",
    "chars": 1018,
    "preview": "/*\n** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $\n** Tag methods\n** See Copyright Notice in lua.h\n*/\n\n#ifndef"
  },
  {
    "path": "src/lua.c",
    "chars": 10523,
    "preview": "/*\n** $Id: lua.c,v 1.160.1.2 2007/12/28 15:32:23 roberto Exp $\n** Lua stand-alone interpreter\n** See Copyright Notice in"
  },
  {
    "path": "src/lua.h",
    "chars": 11907,
    "preview": "/*\n** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $\n** Lua - An Extensible Extension Language\n** Lua.org, PUC"
  },
  {
    "path": "src/luac.c",
    "chars": 4661,
    "preview": "/*\n** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $\n** Lua compiler (saves bytecodes to files; also list bytecodes)\n*"
  },
  {
    "path": "src/luaconf.h",
    "chars": 22673,
    "preview": "/*\n** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $\n** Configuration file for Lua\n** See Copyright Notice "
  },
  {
    "path": "src/lualib.h",
    "chars": 1026,
    "preview": "/*\n** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua standard libraries\n** See Copyright Notice in lu"
  },
  {
    "path": "src/lundump.c",
    "chars": 4629,
    "preview": "/*\n** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice "
  },
  {
    "path": "src/lundump.h",
    "chars": 890,
    "preview": "/*\n** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $\n** load precompiled Lua chunks\n** See Copyright Notice"
  },
  {
    "path": "src/lvm.c",
    "chars": 24274,
    "preview": "/*\n** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/"
  },
  {
    "path": "src/lvm.h",
    "chars": 1593,
    "preview": "/*\n** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua virtual machine\n** See Copyright Notice in lua.h\n*/\n"
  },
  {
    "path": "src/lzio.c",
    "chars": 1628,
    "preview": "/*\n** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $\n** a generic input stream interface\n** See Copyright Noti"
  },
  {
    "path": "src/lzio.h",
    "chars": 1571,
    "preview": "/*\n** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $\n** Buffered streams\n** See Copyright Notice in lua.h\n*/\n\n"
  },
  {
    "path": "src/print.c",
    "chars": 4947,
    "preview": "/*\n** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $\n** print bytecodes\n** See Copyright Notice in lua.h\n*/\n\n#includ"
  },
  {
    "path": "test/README",
    "chars": 1177,
    "preview": "These are simple tests for Lua.  Some of them contain useful code.\nThey are meant to be run to make sure Lua is built co"
  },
  {
    "path": "test/bisect.lua",
    "chars": 645,
    "preview": "-- bisection method for solving non-linear equations\n\ndelta=1e-6\t-- tolerance\n\nfunction bisect(f,a,b,fa,fb)\n local c=(a+"
  },
  {
    "path": "test/cf.lua",
    "chars": 293,
    "preview": "-- temperature conversion table (celsius to farenheit)\n\nfor c0=-20,50-1,10 do\n\tio.write(\"C \")\n\tfor c=c0,c0+10-1 do\n\t\tio."
  },
  {
    "path": "test/echo.lua",
    "chars": 69,
    "preview": "-- echo command line arguments\n\nfor i=0,#arg do\n print(i,arg[i])\nend\n"
  },
  {
    "path": "test/env.lua",
    "chars": 181,
    "preview": "-- read environment variables as if they were global variables\n\nlocal f=function (t,i) return os.getenv(i) end\nsetmetata"
  },
  {
    "path": "test/factorial.lua",
    "chars": 707,
    "preview": "-- function closures are powerful\n\n-- traditional fixed-point operator from functional programming\nY = function (g)\n    "
  },
  {
    "path": "test/fib.lua",
    "chars": 605,
    "preview": "-- fibonacci function with cache\n\n-- very inefficient fibonacci function\nfunction fib(n)\n\tN=N+1\n\tif n<2 then\n\t\treturn n\n"
  },
  {
    "path": "test/fibfor.lua",
    "chars": 254,
    "preview": "-- example of for with generator functions\n\nfunction generatefib (n)\n  return coroutine.wrap(function ()\n    local a,b ="
  },
  {
    "path": "test/globals.lua",
    "chars": 418,
    "preview": "-- reads luac listings and reports global variable usage\n-- lines where a global is written to are marked with \"*\"\n-- ty"
  },
  {
    "path": "test/hello.lua",
    "chars": 86,
    "preview": "-- the first program in every language\n\nio.write(\"Hello world, from \",_VERSION,\"!\\n\")\n"
  },
  {
    "path": "test/life.lua",
    "chars": 2633,
    "preview": "-- life.lua\n-- original by Dave Bollinger <DBollinger@compuserve.com> posted to lua-l\n-- modified to use ANSI terminal e"
  },
  {
    "path": "test/luac.lua",
    "chars": 234,
    "preview": "-- bare-bones luac in Lua\n-- usage: lua luac.lua file.lua\n\nassert(arg[1]~=nil and arg[2]==nil,\"usage: lua luac.lua file."
  },
  {
    "path": "test/printf.lua",
    "chars": 169,
    "preview": "-- an implementation of printf\n\nfunction printf(...)\n io.write(string.format(...))\nend\n\nprintf(\"Hello %s from %s on %s\\n"
  },
  {
    "path": "test/readonly.lua",
    "chars": 260,
    "preview": "-- make global variables readonly\n\nlocal f=function (t,i) error(\"cannot redefine global variable `\"..i..\"'\",2) end\nlocal"
  },
  {
    "path": "test/sieve.lua",
    "chars": 775,
    "preview": "-- the sieve of of Eratosthenes programmed with coroutines\n-- typical usage: lua -e N=1000 sieve.lua | column\n\n-- genera"
  },
  {
    "path": "test/sort.lua",
    "chars": 1494,
    "preview": "-- two implementations of a sort function\n-- this is an example only. Lua has now a built-in function \"sort\"\n\n-- extract"
  },
  {
    "path": "test/table.lua",
    "chars": 283,
    "preview": "-- make table, grouping all data for the same item\n-- input is 2 columns (item, data)\n\nlocal A\nwhile 1 do\n local l=io.re"
  },
  {
    "path": "test/trace-calls.lua",
    "chars": 749,
    "preview": "-- trace calls\n-- example: lua -ltrace-calls bisect.lua\n\nlocal level=0\n\nlocal function hook(event)\n local t=debug.getinf"
  },
  {
    "path": "test/trace-globals.lua",
    "chars": 728,
    "preview": "-- trace assigments to global variables\n\ndo\n -- a tostring that quotes strings. note the use of the original tostring.\n "
  },
  {
    "path": "test/xd.lua",
    "chars": 364,
    "preview": "-- hex dump\n-- usage: lua xd.lua < file\n\nlocal offset=0\nwhile true do\n local s=io.read(16)\n if s==nil then return end\n i"
  },
  {
    "path": "tools/hg_import_split.lua",
    "chars": 763,
    "preview": "\nlocal patch = arg[1]\nif not patch then\n\tprint(\"run:\", arg[0] .. \"<hg_patch_set>\")\n\treturn\nend\n\nlocal prefix, ext = patc"
  }
]

About this extraction

This page contains the full source code of the Neopallium/llvm-lua GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 180 files (1.1 MB), approximately 456.5k tokens, and a symbol index with 990 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!