| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Added as incompatibility, in the manual, the extra return of 'io.lines'.
|
| |
|
|
|
|
|
|
|
|
| |
- more consistent nomenclature for error handling
- more precise definition for dead objects
- added algorithm used by 'math.random'
- added luaL_pushfail
- some other minor changes
|
|
|
|
|
| |
Corrected several small details: added 'const', adjusts in tabs x
spaces, removed unused #includes and #defines, misspellings, etc.
|
|
|
|
|
|
|
| |
'simplesect' encloses the introductory text of sections with
subsections, so that each section either is all text or is all
subsections. (This commit also corrects a small brace error in the
manual and extra spaces/tabs in some other files.)
|
|
|
|
|
| |
Several small improvements, in particular a new subsection consolidating
all status codes in the API.
|
| |
|
| |
|
|
|
|
|
|
| |
Several "metamethods" are not required to be methods (functions),
so it seems clearer not to call them metamethods. The manual now
uses the word 'metavalue' for those values.
|
| |
|
| |
|
| |
|
|
|
|
| |
Function names in the API use only lowercase letters.
|
|
|
|
|
| |
Warnings are mostly a tool to help developers (e.g., by showing hidden
error messages); regular users usually don't need to see them.
|
|
|
|
|
| |
Commit 0d529138042, with the change in the syntax of attributes,
did not update the manual accordingly.
|
|
|
|
|
|
|
|
| |
The macro 'luaL_pushfail' documents all places in the standard libraries
that return nil to signal some kind of failure. It is defined as
'lua_pushnil'. The manual also got a notation (@fail) to document those
returns. The tests were changed to be agnostic regarding whether 'fail'
is 'nil' or 'false'.
|
| |
|
|
|
|
|
|
|
| |
Added the concept of control messages to the warning system, plus the
implementation of the controls "@on"/"@off" to turn warnings on/off.
Moreover, the warning system in the test library adds some other
controls to ease the test of warnings.
|
|
|
|
|
| |
ANSI C is vague about 'setvbuf'; most details are implementation
defined. So, the manual cannot give any guaranties, either.
|
|
|
|
|
|
| |
The loop does not end on end of file, but when the iterator function
fails to read a value. (In particular, the format "a" never fails,
so a loop with 'io.lines(fname, "a")' never ends.)
|
|
|
|
|
|
|
|
|
| |
When initializing a to-be-closed variable, check whether it has a
'__close' metamethod (or is a false value) and raise an error if
if it hasn't. This produces more accurate error messages. (The
check before closing still need to be done: in the C API, the value
is not constant; and the object may lose its '__close' metamethod
during the block.)
|
| |
|
|
|
|
|
| |
A call to 'math.randomseed()' returns the two components of the seed
it set, so that they can be used to set that same seed again.
|
|
|
|
|
|
|
|
|
| |
An error in a closing method may be caused by a lack of resources,
such as memory or stack space, and the error may free enough resources
(by unwinding the stack) to allow the method to work if called again.
If the closing method is already running after some error (including
its own), it is not called again.
|
|
|
|
|
| |
Local constant variables initialized with compile-time constants
are optimized away from the code.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The syntax for local attributes ('const'/'toclose') was unified with
the regular syntax for local variables, so that we can have variables
with attributes in local definitions with multiple names; for instance:
local <toclose> f, <const> err = io.open(fname)
This new syntax does not implement constant propagation, yet.
This commit also has some small improvements to the manual.
|
|
|
|
|
| |
Added new functions to dynamically set the C-stack limit
('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua).
|
|
|
|
|
| |
More precision describing the variables that won't be closed if a
coroutine yields forever.
|
| |
|
|
|
|
|
|
|
|
| |
When there are multiple errors when closing objects, the error
reported by the protected call is the first one, for two reasons:
First, other errors may be caused by this one;
second, the first error is handled in the original execution context,
and therefore has the full traceback.
|
|
|
|
|
|
|
| |
Instead of a 'tocont' flag, the function 'warn' in Lua now receives all
message pieces as multiple arguments in a single call. Besides being
simpler to use, this implementation ensures that Lua code cannot create
unfinished warnings.
|
| |
|
|
|
|
|
| |
Several small changes from feedback on 5.4 alhpa rc1 (warnings,
typos in the manual, and the like)
|
|
|
|
|
|
|
| |
- new error message for "attempt to assign to const variable"
- note in the manual about compatibility options
- comments
- small changes in 'read_line' and 'pushstr'
|
|
|
|
|
| |
A variable can be declared const, which means it cannot be assigned to,
with the syntax 'local <const> name = exp'.
|
|
|
|
|
|
|
| |
The flag for to-be-closed variables was changed from '*toclose'
to '<toclose>'. Several people found confusing the old syntax and
the new one has a clear terminator, making it more flexible for
future changes.
|
|
|
|
|
|
|
|
|
|
|
| |
Back to how it was, a coroutine does not unwind its stack in case of
errors (and therefore do not close its to-be-closed variables). This
allows the stack to be examined after the error. The program can
use 'coroutine.kill' to close the variables.
The function created by 'coroutine.wrap', however, closes the
coroutine's variables in case of errors, as it is impossible to examine
the stack any way.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The function 'require' returns the *loader data* as a second result.
For file searchers, this data is the path where they found the module.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
It is not a good idea to use negative words to describe boolean
values. (When we negate that boolean we create a double negative...)
|
|
|
|
|
|
|
|
|
|
|
| |
The numerical 'for' loop over integers now uses a precomputed counter
to control its number of iteractions. This change eliminates several
weird cases caused by overflows (wrap-around) in the control variable.
(It also ensures that every integer loop halts.)
Also, the special opcodes for the usual case of step==1 were removed.
(The new code is already somewhat complex for the usual case,
but efficient.)
|
|
|
|
|
|
|
|
|
|
|
| |
All UTF-8 encoding functionality (including the escape
sequence '\u') accepts all values from the original UTF-8
specification (with sequences of up to six bytes).
By default, the decoding functions in the UTF-8 library do not
accept invalid Unicode code points, such as surrogates. A new
parameter 'nonstrict' makes them accept all code points up to
(2^31)-1, as in the original UTF-8 specification.
|
|
|
|
|
| |
Non-function __gc metamethods are not ignored; if present, the
metamethod will be called even if it is not a function.
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
| |
When called with no arguments, 'math.randomseed' uses time and ASLR
to generate a somewhat random seed. the initial seed when Lua starts
is generated this way.
|
|
|
|
|
| |
The call 'string.format("%p", val)' gives a Lua equivalent to the
C API function 'lua_topointer'.
|
|
|
|
|
|
|
|
|
|
| |
Several small improvements (code style, warnings, comments, more tests),
in particular:
- 'lua_topointer' extended to handle strings
- raises an error in 'string.format("%10q")' ('%q' with modifiers)
- in the manual for 'string.format', the term "option" replaced by
"conversion specifier" (the term used by the C standard)
|