diff --git a/.travis.yml b/.travis.yml index b7fd0f0b..57493ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,27 +2,40 @@ # LuaDist Travis-CI Hook # -# Since CMake is not directly supported we use erlang VMs -language: erlang +# We assume C build environments +language: C -# We need CMake and LuaDist +# Try using multiple Lua Implementations +env: + - TOOL="gcc" # Use native compiler (GCC usually) + - TOOL="clang" # Use clang + - TOOL="i686-w64-mingw32" # 32bit MinGW + - TOOL="x86_64-w64-mingw32" # 64bit MinGW + - TOOL="arm-linux-gnueabihf" # ARM hard-float (hf), linux + +# Crosscompile builds may fail +matrix: + allow_failures: + - env: TOOL="i686-w64-mingw32" + - env: TOOL="x86_64-w64-mingw32" + - env: TOOL="arm-linux-gnueabihf" + +# Install dependencies install: - - export MODULE=`basename $PWD` - - sudo apt-get install cmake >/dev/null 2>&1 - - git clone git://github.com/LuaDist/bootstrap.git _luadist >/dev/null 2>&1 - - cd _luadist - - git submodule update --init >/dev/null 2>&1 - - ./bootstrap >/dev/null 2>&1 - - export LUADIST=$PWD/_install/bin/luadist - - cd $HOME - -# Use LuaDist to deploy the module + - git clone git://github.com/LuaDist/Tools.git ~/_tools + - ~/_tools/travis/travis install + +# Bootstap +before_script: + - ~/_tools/travis/travis bootstrap + +# Build the module script: - - $LUADIST _test install $LUA $MODULE-scm -verbose=true -test=true + - ~/_tools/travis/travis build # Execute additional tests or commands after_script: - - ./_test/bin/lua -e "print (_VERSION)" + - ~/_tools/travis/travis test # Only watch the master branch branches: @@ -35,4 +48,4 @@ notifications: - luadist-dev@googlegroups.com email: on_success: change - on_failure: always \ No newline at end of file + on_failure: always diff --git a/CMakeLists.txt b/CMakeLists.txt index e445082b..cc303f5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2012 LuaDist. +# Copyright (C) 2007-2013 LuaDist. # Created by Peter Drahoš, Peter Kapec # Redistribution and use of this file is allowed according to the terms of the MIT license. # For details see the COPYRIGHT file distributed with LuaDist. @@ -39,24 +39,31 @@ set ( LUA_CPATH_DEFAULT "./?${LUA_MODULE_SUFFIX};${LUA_DIR}${LUA_CDIR}/?${LUA_MO if ( WIN32 AND NOT CYGWIN ) # Windows systems option ( LUA_WIN "Windows specific build." ON ) - option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ON ) - # Paths (Double escapes needed) - set ( LUA_DIRSEP "\\\\" ) string ( REPLACE " /" ${LUA_DIRSEP} LUA_DIR "${LUA_DIR}" ) + option ( LUA_BUILD_WLUA "Build wLua interpretter without console output." ON ) + option ( LUA_BUILD_AS_DLL "Build Lua library as Dll." ${BUILD_SHARED_LIBS} ) + + # Paths (Double escapes ne option needed) + set ( LUA_DIRSEP "\\\\" ) + string ( REPLACE " /" ${LUA_DIRSEP} LUA_DIR "${LUA_DIR}" ) string ( REPLACE "/" ${LUA_DIRSEP} LUA_LDIR "${LUA_LDIR}" ) string ( REPLACE "/" ${LUA_DIRSEP} LUA_CDIR "${LUA_CDIR}" ) string ( REPLACE "/" ${LUA_DIRSEP} LUA_PATH_DEFAULT "${LUA_PATH_DEFAULT}" ) string ( REPLACE "/" ${LUA_DIRSEP} LUA_CPATH_DEFAULT "${LUA_CPATH_DEFAULT}" ) else ( ) # Posix systems (incl. Cygwin) - option ( LUA_USE_POSIX "Use POSIX functionality." ON ) + option ( LUA_USE_POSIX "Use POSIX features." ON ) option ( LUA_USE_DLOPEN "Use dynamic linker to load modules." ON ) option ( LUA_USE_MKSTEMP "Use mkstep." ON ) option ( LUA_USE_ISATTY "Use tty." ON ) option ( LUA_USE_POPEN "Use popen." ON ) option ( LUA_USE_ULONGJMP "Use ulongjmp" ON ) - option ( LUA_USE_STRTODHEX "assume 'strtod' handles hexa formats" ON ) - option ( LUA_USE_AFORMAT "assume 'printf' handles 'aA' specifiers" ON ) - option ( LUA_USE_LONGLONG "assume support for long long" ON ) + option ( LUA_USE_GMTIME_R "Use GTIME_R" ON ) + # Apple and Linux specific + if ( LINUX OR APPLE ) + option ( LUA_USE_STRTODHEX "Assume 'strtod' handles hexa formats" ON ) + option ( LUA_USE_AFORMAT "Assume 'printf' handles 'aA' specifiers" ON ) + option ( LUA_USE_LONGLONG "Assume support for long long" ON ) + endif ( ) endif ( ) ## SETUP @@ -79,7 +86,10 @@ endif ( ) if ( LUA_USE_DLOPEN ) # Link to dynamic linker library "dl" - list ( APPEND LIBS dl ) + find_library ( DL_LIBRARY NAMES dl ) + if ( DL_LIBRARY ) + list ( APPEND LIBS ${DL_LIBRARY} ) + endif ( ) endif ( ) if ( LUA_USE_READLINE ) @@ -117,9 +127,12 @@ endif ( ) ## BUILD # Create lua library -add_library ( liblua SHARED ${SRC_CORE} ${SRC_LIB} ${LUA_DLL_RC} ${LUA_DEF} ) +add_library ( liblua ${SRC_CORE} ${SRC_LIB} ${LUA_DLL_RC} ${LUA_DEF} ) target_link_libraries ( liblua ${LIBS} ) set_target_properties ( liblua PROPERTIES OUTPUT_NAME lua CLEAN_DIRECT_OUTPUT 1 ) +if ( LUA_BUILD_AS_DLL ) + set_target_properties ( liblua PROPERTIES COMPILE_DEFINITIONS LUA_BUILD_AS_DLL ) +endif () add_executable ( lua ${SRC_LUA} src/lua.rc ) target_link_libraries ( lua liblua ) @@ -127,11 +140,18 @@ target_link_libraries ( lua liblua ) add_executable ( luac ${SRC_CORE} ${SRC_LIB} ${SRC_LUAC} src/luac.rc ) target_link_libraries ( luac ${LIBS} ) +# On windows a variant of the lua interpreter without console output needs to be built +if ( LUA_BUILD_WLUA ) + add_executable ( wlua WIN32 src/wmain.c ${SRC_LUA} src/lua.rc ) + target_link_libraries ( wlua liblua ) + install_executable ( wlua ) +endif ( ) + install_executable ( lua luac ) install_library ( liblua ) install_data ( README.md ) #install_lua_module ( strict etc/strict.lua ) -install_header ( src/lua.h src/lualib.h src/lauxlib.h ${CMAKE_CURRENT_BINARY_DIR}/luaconf.h ) +install_header ( src/lua.h src/lualib.h src/lauxlib.h src/lua.hpp ${CMAKE_CURRENT_BINARY_DIR}/luaconf.h ) install_doc ( doc/ ) install_foo ( etc/ ) #install_test ( test/ ) diff --git a/Makefile b/Makefile index bd9515fd..b2a62cfd 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.2 -R= $V.1 +R= $V.4 # Targets start here. all: $(PLAT) diff --git a/README.md b/README.md index e07e097e..710e3ee1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -This is Lua 5.2.1, released on 08 Jun 2012. -================ +This is Lua 5.2.4, released on 25 Feb 2015. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/dist.info b/dist.info index c239db34..50f91867 100644 --- a/dist.info +++ b/dist.info @@ -1,10 +1,15 @@ --- This file is part of LuaDist project name = "lua" -version = "5.2.1" +version = "5.2.4" desc = "Lua is a powerful, fast, light-weight, embeddable scripting language." author = "Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo" license = "MIT/X11" url = "http://www.lua.org" maintainer = "Peter Drahoš" + +-- Offers functionality of the following packages +provides = { + "bit32-5.2.0" +} diff --git a/doc/contents.html b/doc/contents.html index 9f506051..9d5202fa 100644 --- a/doc/contents.html +++ b/doc/contents.html @@ -7,7 +7,6 @@ @@ -23,7 +22,7 @@

The reference manual is the official definition of the Lua language. For a complete introduction to Lua programming, see the book -Programming in Lua. +Programming in Lua.

start @@ -33,7 +32,7 @@

index
-Copyright © 2011–2012 Lua.org, PUC-Rio. +Copyright © 2011–2015 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -139,18 +138,18 @@

Index

Lua functions

+basic
_G
_VERSION
-

assert
collectgarbage
dofile
error
getmetatable
ipairs
-loadfile
load
+loadfile
next
pairs
pcall
@@ -168,6 +167,7 @@

Lua functions

xpcall

+bit32
bit32.arshift
bit32.band
bit32.bnot
@@ -182,6 +182,7 @@

Lua functions

bit32.rshift

+coroutine
coroutine.create
coroutine.resume
coroutine.running
@@ -190,6 +191,7 @@

Lua functions

coroutine.yield

+debug
debug.debug
debug.getuservalue
debug.gethook
@@ -208,15 +210,7 @@

Lua functions

debug.upvaluejoin

-file:close
-file:flush
-file:lines
-file:read
-file:seek
-file:setvbuf
-file:write
- -

+io
io.close
io.flush
io.input
@@ -231,11 +225,19 @@

Lua functions

io.tmpfile
io.type
io.write
+file:close
+file:flush
+file:lines
+file:read
+file:seek
+file:setvbuf
+file:write

 

+math
math.abs
math.acos
math.asin
@@ -267,6 +269,7 @@

 

math.tanh

+os
os.clock
os.date
os.difftime
@@ -280,6 +283,7 @@

 

os.tmpname

+package
package.config
package.cpath
package.loaded
@@ -290,6 +294,7 @@

 

package.searchpath

+string
string.byte
string.char
string.dump
@@ -306,6 +311,7 @@

 

string.upper

+table
table.concat
table.insert
table.pack
@@ -313,6 +319,14 @@

 

table.sort
table.unpack
+

environment
variables

+LUA_CPATH
+LUA_CPATH_5_2
+LUA_INIT
+LUA_INIT_5_2
+LUA_PATH
+LUA_PATH_5_2
+

C API

@@ -385,6 +399,7 @@

C API

lua_pushcclosure
lua_pushcfunction
lua_pushfstring
+lua_pushglobaltable
lua_pushinteger
lua_pushlightuserdata
lua_pushliteral
@@ -393,15 +408,16 @@

C API

lua_pushnumber
lua_pushstring
lua_pushthread
+lua_pushunsigned
lua_pushvalue
lua_pushvfstring
lua_rawequal
lua_rawget
lua_rawgeti
+lua_rawgetp
lua_rawlen
lua_rawset
lua_rawseti
-lua_rawgetp
lua_rawsetp
lua_register
lua_remove
@@ -460,8 +476,8 @@

auxiliary library

luaL_buffinitsize
luaL_callmeta
luaL_checkany
-luaL_checkinteger
luaL_checkint
+luaL_checkinteger
luaL_checklong
luaL_checklstring
luaL_checknumber
@@ -492,8 +508,8 @@

auxiliary library

luaL_newmetatable
luaL_newstate
luaL_openlibs
-luaL_optinteger
luaL_optint
+luaL_optinteger
luaL_optlong
luaL_optlstring
luaL_optnumber
@@ -514,6 +530,67 @@

auxiliary library

luaL_unref
luaL_where
+

standard library

+

+luaopen_base
+luaopen_bit32
+luaopen_coroutine
+luaopen_debug
+luaopen_io
+luaopen_math
+luaopen_os
+luaopen_package
+luaopen_string
+luaopen_table
+ +

constants

+LUA_ERRERR
+LUA_ERRFILE
+LUA_ERRGCMM
+LUA_ERRMEM
+LUA_ERRRUN
+LUA_ERRSYNTAX
+LUA_HOOKCALL
+LUA_HOOKCOUNT
+LUA_HOOKLINE
+LUA_HOOKRET
+LUA_HOOKTAILCALL
+LUA_MASKCALL
+LUA_MASKCOUNT
+LUA_MASKLINE
+LUA_MASKRET
+LUA_MINSTACK
+LUA_MULTRET
+LUA_NOREF
+LUA_OK
+LUA_OPADD
+LUA_OPDIV
+LUA_OPEQ
+LUA_OPLE
+LUA_OPLT
+LUA_OPMOD
+LUA_OPMUL
+LUA_OPPOW
+LUA_OPSUB
+LUA_OPUNM
+LUA_REFNIL
+LUA_REGISTRYINDEX
+LUA_RIDX_GLOBALS
+LUA_RIDX_MAINTHREAD
+LUA_TBOOLEAN
+LUA_TFUNCTION
+LUA_TLIGHTUSERDATA
+LUA_TNIL
+LUA_TNONE
+LUA_TNUMBER
+LUA_TSTRING
+LUA_TTABLE
+LUA_TTHREAD
+LUA_TUSERDATA
+LUA_USE_APICHECK
+LUA_YIELD
+LUAL_BUFFERSIZE
+ @@ -521,10 +598,10 @@

auxiliary library


Last update: -Sat May 26 08:52:25 BRT 2012 +Mon Feb 23 22:24:36 BRT 2015 diff --git a/doc/lua.css b/doc/lua.css index 7fafbb1b..5dc9a8b9 100644 --- a/doc/lua.css +++ b/doc/lua.css @@ -1,30 +1,38 @@ +html { + background-color: #F8F8F8 ; +} + body { + border: solid #a0a0a0 1px ; + border-radius: 20px ; + padding: 26px ; + margin: 16px ; color: #000000 ; background-color: #FFFFFF ; font-family: Helvetica, Arial, sans-serif ; text-align: justify ; - margin-right: 30px ; - margin-left: 30px ; + line-height: 1.25 ; } h1, h2, h3, h4 { font-family: Verdana, Geneva, sans-serif ; font-weight: normal ; - font-style: italic ; + font-style: normal ; } h2 { padding-top: 0.4em ; padding-bottom: 0.4em ; - padding-left: 30px ; - padding-right: 30px ; - margin-left: -30px ; - background-color: #E0E0FF ; + padding-left: 0.8em ; + padding-right: 0.8em ; + background-color: #D0D0FF ; + border-radius: 8px ; + border: solid #a0a0a0 1px ; } h3 { padding-left: 0.5em ; - border-left: solid #E0E0FF 1em ; + border-left: solid #D0D0FF 1em ; } table h3 { @@ -45,39 +53,54 @@ a:visited { a:link:hover, a:visited:hover { color: #000080 ; - background-color: #E0E0FF ; + background-color: #D0D0FF ; + border-radius: 4px ; } a:link:active, a:visited:active { color: #FF0000 ; } +h1 a img { + vertical-align: text-bottom ; +} + hr { border: 0 ; height: 1px ; color: #a0a0a0 ; background-color: #a0a0a0 ; + display: none ; +} + +table hr { + display: block ; } :target { background-color: #F8F8F8 ; padding: 8px ; border: solid #a0a0a0 2px ; + border-radius: 8px ; } .footer { color: gray ; - font-size: small ; + font-size: x-small ; } input[type=text] { border: solid #a0a0a0 2px ; border-radius: 2em ; - -moz-border-radius: 2em ; background-image: url('images/search.png') ; - background-repeat: no-repeat; + background-repeat: no-repeat ; background-position: 4px center ; padding-left: 20px ; height: 2em ; } +pre.session { + background-color: #F8F8F8 ; + padding: 1em ; + border-radius: 8px ; +} diff --git a/doc/manual.css b/doc/manual.css index b49b3629..ca613cd9 100644 --- a/doc/manual.css +++ b/doc/manual.css @@ -16,9 +16,12 @@ span.apii { } p+h1, ul+h1 { + font-style: normal ; padding-top: 0.4em ; padding-bottom: 0.4em ; - padding-left: 30px ; - margin-left: -30px ; - background-color: #E0E0FF ; + padding-left: 16px ; + margin-left: -16px ; + background-color: #D0D0FF ; + border-radius: 8px ; + border: solid #000080 1px ; } diff --git a/doc/manual.html b/doc/manual.html index 4ba084df..0a95e9e0 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -19,7 +19,7 @@

by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes

-Copyright © 2011–2012 Lua.org, PUC-Rio. +Copyright © 2011–2015 Lua.org, PUC-Rio. Freely available under the terms of the Lua license. @@ -33,7 +33,7 @@

- + @@ -424,7 +424,6 @@

2.4 – Metatables and Metamethods

      rawget(getmetatable(obj) or {}, event)
 

- This means that the access to a metamethod does not invoke other metamethods, and access to objects with no metatables does not fail (it simply results in nil). @@ -915,7 +914,7 @@

2.5.1 – Garbage-Collection Metamethods

When you close a state (see lua_close), -Lua calls the finalizers of all objects marked for collection, +Lua calls the finalizers of all objects marked for finalization, following the reverse order that they were marked. If any finalizer marks new objects for collection during that phase, these new objects will not be finalized. @@ -1255,8 +1254,7 @@

3.1 – Lexical Conventions

-When parsing a from a string source, -any byte in a literal string not +Any byte in a literal string not explicitly affected by the previous rules represents itself. However, Lua opens files for parsing in text mode, and the system file functions may have problems with @@ -1409,6 +1407,35 @@

3.3.1 – Blocks

stat ::= ‘;’ +

+Function calls and assignments +can start with an open parenthesis. +This possibility leads to an ambiguity in Lua's grammar. +Consider the following fragment: + +

+     a = b + c
+     (print or io.write)('done')
+

+The grammar could see it in two ways: + +

+     a = b + c(print or io.write)('done')
+     
+     a = b + c; (print or io.write)('done')
+

+The current parser always sees such constructions +in the first way, +interpreting the open parenthesis +as the start of the arguments to a call. +To avoid this ambiguity, +it is a good practice to always precede with a semicolon +statements that start with a parenthesis: + +

+     ;(print or io.write)('done')
+
+

A block can be explicitly delimited to produce a single statement: @@ -1428,7 +1455,7 @@

3.3.1 – Blocks

3.3.2 – Chunks

-The unit of execution of Lua is called a chunk. +The unit of compilation of Lua is called a chunk. Syntactically, a chunk is simply a block: @@ -1859,7 +1886,8 @@

3.4 – Expressions

(unless the expression is enclosed in parentheses). In all other contexts, Lua adjusts the result list to one element, -discarding all values except the first one. +either discarding all values except the first one +or adding a single nil if there are no values.

@@ -2060,7 +2088,7 @@

3.4.6 – The Length Operator

table is a sequence, that is, the set of its positive numeric keys is equal to {1..n} -for some integer n. +for some non-negative integer n. In that case, n is its length. Note that a table like @@ -2559,32 +2587,35 @@

4.3 – Valid and Acceptable Indices

A valid index is an index that refers to a -valid position within the stack, that is, -it lies between 1 and the stack top +real position within the stack, that is, +its position lies between 1 and the stack top (1 ≤ abs(index) ≤ top). -Usually, functions that need a specific stack position -(e.g., lua_remove) require valid indices. +Usually, functions that can modify the value at an index +require valid indices. + + +

+Unless otherwise noted, +any function that accepts valid indices also accepts pseudo-indices, +which represent some Lua values that are accessible to C code +but which are not in the stack. +Pseudo-indices are used to access the registry +and the upvalues of a C function (see §4.4).

Functions that do not need a specific stack position, but only a value in the stack (e.g., query functions), can be called with acceptable indices. -An acceptable index refers to a position within -the space allocated for the stack, +An acceptable index can be any valid index, +including the pseudo-indices, +but it also can be any positive index after the stack top +within the space allocated for the stack, that is, indices up to the stack size. -More formally, we define an acceptable index -as follows: - -

-     (index < 0 && abs(index) <= top) ||
-     (index > 0 && index <= stack size)
-

(Note that 0 is never an acceptable index.) -When a function is called, -its stack size is top + LUA_MINSTACK. -You can change its stack size through function lua_checkstack. +Except when noted otherwise, +functions in the API work with acceptable indices.

@@ -2598,16 +2629,8 @@

4.3 – Valid and Acceptable Indices

For functions that can be called with acceptable indices, any non-valid index is treated as if it -contains a value of a virtual type LUA_TNONE. - - -

-Unless otherwise noted, -any function that accepts valid indices also accepts pseudo-indices, -which represent some Lua values that are accessible to C code -but which are not in the stack. -Pseudo-indices are used to access the registry -and the upvalues of a C function (see §4.4). +contains a value of a virtual type LUA_TNONE, +which behaves like a nil value. @@ -2628,13 +2651,13 @@

4.4 – C Closures

Whenever a C function is called, its upvalues are located at specific pseudo-indices. These pseudo-indices are produced by the macro -lua_upvalueindex. +lua_upvalueindex. The first value associated with a function is at position lua_upvalueindex(1), and so on. Any access to lua_upvalueindex(n), where n is greater than the number of upvalues of the current function (but not greater than 256), -produces an acceptable (but invalid) index. +produces an acceptable but invalid index. @@ -2647,7 +2670,8 @@

4.5 – Registry

a predefined table that can be used by any C code to store whatever Lua values it needs to store. The registry table is always located at pseudo-index -LUA_REGISTRYINDEX. +LUA_REGISTRYINDEX, +which is a valid index. Any C library can store data into this table, but it should take care to choose keys that are different from those used @@ -2692,8 +2716,8 @@

4.6 – Error Handling in C

Internally, Lua uses the C longjmp facility to handle errors. -(You can also choose to use exceptions if you use C++; -see file luaconf.h.) +(You can also choose to use exceptions if you compile Lua as C++; +search for LUAI_THROW in the source code.) When Lua faces any error (such as a memory allocation error, type errors, syntax errors, and runtime errors) @@ -3136,8 +3160,8 @@

4.8 – Functions and Types

Compares two Lua values. -Returns 1 if the value at acceptable index index1 satisfies op -when compared with the value at acceptable index index2, +Returns 1 if the value at index index1 satisfies op +when compared with the value at index index2, following the semantics of the corresponding Lua operator (that is, it may call metamethods). Otherwise returns 0. @@ -3180,7 +3204,7 @@

4.8 – Functions and Types

void lua_copy (lua_State *L, int fromidx, int toidx);

-Moves the element at the valid index fromidx +Moves the element at index fromidx into the valid index toidx without shifting any element (therefore replacing the value at that position). @@ -3390,7 +3414,7 @@

4.8 – Functions and Types

Pushes onto the stack the value t[k], -where t is the value at the given valid index. +where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4). @@ -3414,8 +3438,7 @@

4.8 – Functions and Types

int lua_getmetatable (lua_State *L, int index);

-Pushes onto the stack the metatable of the value at the given -acceptable index. +Pushes onto the stack the metatable of the value at the given index. If the value does not have a metatable, the function returns 0 and pushes nothing on the stack. @@ -3429,7 +3452,7 @@

4.8 – Functions and Types

Pushes onto the stack the value t[k], -where t is the value at the given valid index +where t is the value at the given index and k is the value at the top of the stack. @@ -3477,7 +3500,7 @@

4.8 – Functions and Types

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, +This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position. @@ -3505,7 +3528,7 @@

4.8 – Functions and Types

int lua_isboolean (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a boolean, +Returns 1 if the value at the given index is a boolean, and 0 otherwise. @@ -3517,7 +3540,7 @@

4.8 – Functions and Types

int lua_iscfunction (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a C function, +Returns 1 if the value at the given index is a C function, and 0 otherwise. @@ -3529,7 +3552,7 @@

4.8 – Functions and Types

int lua_isfunction (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a function +Returns 1 if the value at the given index is a function (either C or Lua), and 0 otherwise. @@ -3541,7 +3564,7 @@

4.8 – Functions and Types

int lua_islightuserdata (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a light userdata, +Returns 1 if the value at the given index is a light userdata, and 0 otherwise. @@ -3553,7 +3576,7 @@

4.8 – Functions and Types

int lua_isnil (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is nil, +Returns 1 if the value at the given index is nil, and 0 otherwise. @@ -3565,8 +3588,7 @@

4.8 – Functions and Types

int lua_isnone (lua_State *L, int index);

-Returns 1 if the given acceptable index is not valid -(that is, it refers to an element outside the current stack), +Returns 1 if the given index is not valid, and 0 otherwise. @@ -3578,8 +3600,7 @@

4.8 – Functions and Types

int lua_isnoneornil (lua_State *L, int index);

-Returns 1 if the given acceptable index is not valid -(that is, it refers to an element outside the current stack) +Returns 1 if the given index is not valid or if the value at this index is nil, and 0 otherwise. @@ -3592,7 +3613,7 @@

4.8 – Functions and Types

int lua_isnumber (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a number +Returns 1 if the value at the given index is a number or a string convertible to a number, and 0 otherwise. @@ -3605,7 +3626,7 @@

4.8 – Functions and Types

int lua_isstring (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a string +Returns 1 if the value at the given index is a string or a number (which is always convertible to a string), and 0 otherwise. @@ -3618,7 +3639,7 @@

4.8 – Functions and Types

int lua_istable (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a table, +Returns 1 if the value at the given index is a table, and 0 otherwise. @@ -3630,7 +3651,7 @@

4.8 – Functions and Types

int lua_isthread (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a thread, +Returns 1 if the value at the given index is a thread, and 0 otherwise. @@ -3642,7 +3663,7 @@

4.8 – Functions and Types

int lua_isuserdata (lua_State *L, int index);

-Returns 1 if the value at the given acceptable index is a userdata +Returns 1 if the value at the given index is a userdata (either full or light), and 0 otherwise. @@ -3654,7 +3675,7 @@

4.8 – Functions and Types

void lua_len (lua_State *L, int index);

-Returns the "length" of the value at the given acceptable index; +Returns the "length" of the value at the given index; it is equivalent to the '#' operator in Lua (see §3.4.6). The result is pushed on the stack. @@ -3718,6 +3739,12 @@

4.8 – Functions and Types

a NULL value is equivalent to the string "bt". +

+lua_load uses the stack internally, +so the reader function should always leave the stack +unmodified when returning. + +

If the resulting function has one upvalue, this upvalue is set to the value of the global environment @@ -4038,7 +4065,7 @@

4.8 – Functions and Types

Pushes onto the stack a formatted string and returns a pointer to this string. -It is similar to the C function sprintf, +It is similar to the ISO C function sprintf, but has some important differences: