Roberto Ierusalimschy
e888976bc6
Details (typos in comments)
5 years ago
Roberto Ierusalimschy
2b8b53864c
Improvements in 'luaL_traceback'
'luaL_traceback' changed to use an aux buffer instead of concats.
This should reduce the quantity of garbage it generates (in the
form of intermediate strings) while producing a trackback.
It also added information about the number of levels skipped when
skipping levels in a trace.
6 years ago
Roberto Ierusalimschy
0b63d79b36
Details
- 'luaL_setfuncs' avoids creating closures for placeholders.
- Fixed some warnings about unused values in comma expressions.
- Comments.
6 years ago
Roberto Ierusalimschy
c65605151c
New function 'luaL_addgsub'
Added a new function 'luaL_addgsub', similar to 'luaL_gsub' but that
adds its result directly to a preexisting buffer, avoiding the creation
of one extra intermediate string. Also added two simple macros,
'luaL_bufflen' and 'luaL_buffaddr', to query the current length
and the contents address of a buffer.
6 years ago
Roberto Ierusalimschy
b56d4e570a
Changes in the warning system
- The warning functions get an extra parameter that tells whether
message is to be continued (instead of using end-of-lines as a signal).
- The user data for the warning function is a regular value, instead
of a writable slot inside the Lua state.
6 years ago
Roberto Ierusalimschy
437a5b07d4
Added a warning system to Lua
The warning system is just a way for Lua to emit warnings, messages
to the programmer that do not interfere with the running program.
6 years ago
Roberto Ierusalimschy
46beca5bed
Better error messages for some polymorphic functions
New auxiliary functions/macros 'luaL_argexpected'/'luaL_typeerror'
ease the creation of error messages such as
bad argument #2 to 'setmetatable' (nil or table expected, got boolean)
(The novelty being the "got boolean" part...)
6 years ago
Roberto Ierusalimschy
7696c6474f
Auxiliary buffer cannot close box with 'lua_remove'
To remove a to-be-closed variable from the stack in the C API a
function must use 'lua_settop' or 'lua_pop'. Previous implementation of
'luaL_pushresult' was not closing the box. (This commit also added
tests to check that box is being closed "as soon as possible".)
6 years ago
Roberto Ierusalimschy
8cb84210ab
String buffer using to-be-closed variable
The string buffers in the C API now mark their boxes as to-be-closed
variables, to release their buffers in case of errors.
6 years ago
Roberto Ierusalimschy
9eafe9c053
New implementation for 'luaL_addvalue'
The function 'luaL_addvalue' (from the buffer system) was rewritten
so that it does not change the position of the box (if present)
in the stack.
6 years ago
Roberto Ierusalimschy
2fc6b55dae
Removed resource-related "emergency collections"
New to-be-closed variables is a better way to ensure the proper release
of resources.
6 years ago
Roberto Ierusalimschy
3d838f635c
Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'
These operations also can give errors for lack of resources, so they
also will try "emergency collections" in case of resource errors.
Because there are now two libraries with that kind of handling,
'resourcetryagain' was moved to the auxiliary library to be shared
by the libraries.
6 years ago
Roberto Ierusalimschy
af70905246
no need to check whether libraries and host use the same kernel;
Lua should work correctly with several copies of the kernel
6 years ago
Roberto Ierusalimschy
34b00c16e2
removed compatibility code with older versions
7 years ago
Roberto Ierusalimschy
c67603fafb
using new 'lua_newuserdatauv' instead of 'lua_newuserdata'
7 years ago
Roberto Ierusalimschy
90569630d6
detail
(uses a reserved-format name for an internal type in the registry)
7 years ago
Roberto Ierusalimschy
5a1c8d8ef3
new constant 'LUA_GNAME' for the name of the global table "_G"
7 years ago
Roberto Ierusalimschy
2caecf1b3e
type 'L_Umaxalign' replaced by macro 'LUAI_MAXALIGN', which is also added
to the auxlib buffer
8 years ago
Roberto Ierusalimschy
9903dd52a3
Using LUAI_UAC* types more consistently on vararg calls
8 years ago
Roberto Ierusalimschy
b2aa2ba046
using constants for "_LOADED" and "PRELOAD"
8 years ago
Roberto Ierusalimschy
beec5af201
'luaL_tolstring' uses metatable's "__name" when available
8 years ago
Roberto Ierusalimschy
62f6652d53
no more extra space in 'luaL_checkstack'. (It was already useless
for the first call, and function works ok without that space
anyway (just error message misses the 'msg' component)
9 years ago
Roberto Ierusalimschy
bda090b961
comments + small code changes around stack usage when 'luaL_checkstack'
raises an error (and needs the stack to create the error message...)
9 years ago
Roberto Ierusalimschy
d103312661
details (typos in comments)
9 years ago
Roberto Ierusalimschy
8949904783
allow NULL string when length is zero in 'lua_pushlstring' and
'luaL_addlstring'
9 years ago
Roberto Ierusalimschy
e290bd6760
in 'luaL_traceback', print correct number of levels even when
initial level is not 1.
9 years ago
Roberto Ierusalimschy
e7f34ad395
better implementation for buffers (reallocated memory directly
with allocation function; generates much less garbage)
10 years ago
Roberto Ierusalimschy
90d016980f
detail ('luaL_getmetatable' does not return a boolean, but a tag)
10 years ago
Roberto Ierusalimschy
151dc5cc5f
traverse loaded modules (instead of globals) for a name for a function +
removes prefix '_G.' from names (if present)
10 years ago
Roberto Ierusalimschy
c8da3fbc35
in traceback names, give preference to 'name' over '_G.name'
10 years ago
Roberto Ierusalimschy
6f54b07663
give preference to global names in tracebacks
10 years ago
Roberto Ierusalimschy
ab4a890d04
use 'namewhat' when building a traceback
10 years ago
Roberto Ierusalimschy
db5ac2fa0d
detail (buffer in 'LoadF' is related to files)
10 years ago
Roberto Ierusalimschy
cb59019f58
uses return value from luaL_getmetatable
10 years ago
Roberto Ierusalimschy
28fdbcf393
added include for 'lprefix.h', for stuff that must be added before
any other header file
10 years ago
Roberto Ierusalimschy
05afee0f50
definitions for 'luai_writestring'/'luai_writeline'/'luai_writestringerror'
moved to 'lauxlib.h' (they do not need to be stable or configurable) +
prefixes changed from 'luai_' to 'lua_' (they are not part of the core)
10 years ago
Roberto Ierusalimschy
bdf566a8a3
`name' in comments changed to 'name'
10 years ago
Roberto Ierusalimschy
6b12b82532
added 'l_' prefix for names that can be redefined externally
10 years ago
Roberto Ierusalimschy
f97c64d7bf
macros 'LUA_QL'/'LUA_QL' deprecated
10 years ago
Roberto Ierusalimschy
6384475ec4
'luaL_getmetafield' returns type of metafield (instead of a boolean)
10 years ago
Roberto Ierusalimschy
8704fca0c9
in 'luaL_checkversion_' check numeric types first. (Other tests
depend on correct numeric type.)
10 years ago
Roberto Ierusalimschy
8bb272a3e3
new conversion float->integer: conversion is valid only when
float has an exact representation as an integer
10 years ago
Roberto Ierusalimschy
c229ed597f
'requiref' checks 'package.loaded' before loading a module
10 years ago
Roberto Ierusalimschy
a77d263e86
unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)
deprecated
11 years ago
Roberto Ierusalimschy
45c430eac0
addition of '.0' to float representation done by the kernel
11 years ago
Roberto Ierusalimschy
4422b97472
keep 'luaL_checkversion_' with its signature in version 5.2, for
correct error messages in case of version mixings
11 years ago
Roberto Ierusalimschy
5aeb57f11f
detail (error message for conversion from float to integer)
11 years ago
Roberto Ierusalimschy
a3addae036
lua_gettable and similars return type of gotten value
11 years ago
Roberto Ierusalimschy
a4c6dcf999
detail (better error messages for light userdata)
11 years ago
Roberto Ierusalimschy
4a1ed6e6e5
new field '__name' in metatables to help better error messages
11 years ago