Commit Graph

172 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
a08d82eb13 llimits.h being used by all Lua code
The definitions in llimits.h are useful not only for the core. That
header only defines types and '#define's, so libs and core still do
not share any real code/data.
2024-06-20 14:46:06 -03:00
Roberto Ierusalimschy
7360f8d0fd Removed deprecated function 'setcstacklimit' 2024-02-07 14:20:43 -03:00
Roberto Ierusalimschy
59c88f846d Broadening the use of branch hints
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
2021-02-24 11:14:44 -03:00
Roberto Ierusalimschy
38cc7d40a4 Bug: cannot allow the call 'debug.getinfo(0, ">")'
A 'what' argument starting with '>' indicates that there is a function
in the C stack, which won't be there if the first argument is not a
function.
2021-02-15 10:38:09 -03:00
Roberto Ierusalimschy
d9d2904f09 Details
Names in the parser and other details that do not change actual code.
2020-12-02 15:13:13 -03:00
Roberto Ierusalimschy
30528049f1 'lua_upvalueid' returns NULL on invalid upvalue index 2020-10-12 14:51:28 -03:00
Roberto Ierusalimschy
287b302acb Revision of stackless implementation
- more organized handling of 'nCcalls'
- comments
- deprecation of 'setcstacklimit'
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
364e569945 Avoid calling 'fprintf' with NULL
Avoid undefined behavior in calls like «fprintf("%s", NULL)».
('lua_writestringerror' is implemented as 'fprintf', and 'lua_tostring'
can return NULL if object is not a string.)
2020-06-09 16:12:01 -03:00
Roberto Ierusalimschy
6eb53b7526 Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
2020-02-27 12:59:22 -03:00
Roberto Ierusalimschy
7bd1e53753 Fixed a warning and other minor issues
Fixed some minor issues from the feedback for 5.4-beta rc1.
2019-10-04 16:17:04 -03:00
Roberto Ierusalimschy
03cde80b58 'setCstacklimit' renamed to 'setcstacklimit'
Function names in the API use only lowercase letters.
2019-09-24 14:31:06 -03:00
Roberto Ierusalimschy
b96b0b5abb Added macro 'luaL_pushfail'
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'.
2019-08-16 14:58:02 -03:00
Roberto Ierusalimschy
3c0d3c6fbe Avoid using addresses of static variables as unique keys
The addresses of static variables may be different for different
instances of Lua, making these instances incompatible if they use
these addresses as unique keys in the registry (or other tables).
2019-07-19 13:14:06 -03:00
Roberto Ierusalimschy
be73f72fcc New function 'setCstacklimit'
Added new functions to dynamically set the C-stack limit
('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua).
2019-06-18 16:52:22 -03:00
Roberto Ierusalimschy
5ca1075b71 Added field 'srclen' to structure 'lua_Debug'
This new field gets the length of 'source' in the same structure.
Unlike the other strings in that structure, 'source' can be
relatively large, and Lua already has its length readily available.
2019-04-04 11:45:26 -03:00
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...)
2018-12-10 13:46:03 -02:00
Roberto Ierusalimschy
f99509581e Removed extra information from RCS keyword strings
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
2018-08-23 14:26:12 -03:00
Roberto Ierusalimschy
4907444db9 'fTransfer' -> 'ftransfer' / 'nTransfer' -> 'ntransfer'
(keep the standard of names in lower case)
2018-03-16 12:33:34 -03:00
Roberto Ierusalimschy
8b0b675149 added casts (warnings in VS) 2018-03-05 11:15:04 -03:00
Roberto Ierusalimschy
ca6fe7449a userdata can have multiple user values 2018-02-20 13:52:50 -03:00
Roberto Ierusalimschy
422318f677 two new fields 'fTransfer'/'nTransfer' in 'lua_Debug' structure
(for information about values being given and returned in function calls)
2018-02-17 17:29:29 -02:00
Roberto Ierusalimschy
c5112f7b15 details (comments) 2015-11-23 09:30:45 -02:00
Roberto Ierusalimschy
d103312661 details (typos in comments) 2015-11-19 17:16:22 -02:00
Roberto Ierusalimschy
97f2aa5a44 bug: when manipulating other threads, there is no garanties about
their stack space
2015-02-19 15:06:21 -02:00
Roberto Ierusalimschy
3a29087cb7 'lua_setlocal' should not pop value when failing (to be consistent
with the manual and with 'lua_setupvalue')
2015-01-02 10:52:22 -02:00
Roberto Ierusalimschy
6909b5a2b4 In 'debug.gethook', does not query hook table (which may not exist) if
there is no hook set
2014-12-08 13:47:25 -02:00
Roberto Ierusalimschy
fee3aa518d using address key (light userdata) for hook table, instead of
string
2014-11-10 12:27:16 -02:00
Roberto Ierusalimschy
28fdbcf393 added include for 'lprefix.h', for stuff that must be added before
any other header file
2014-11-02 17:19:04 -02:00
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)
2014-10-29 14:12:30 -02:00
Roberto Ierusalimschy
ea3155e380 'debug.sizeof' removed 2014-10-17 08:07:26 -03:00
Roberto Ierusalimschy
798660c9cd deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.) 2014-10-01 08:54:56 -03:00
Roberto Ierusalimschy
e401513086 new option 'p' for 'debug.sizeof' (size of a pointer) 2014-08-22 13:22:42 -03:00
Roberto Ierusalimschy
01549fb1ed 'Csize' -> 'sizeof' + removed its 'b' option 2014-08-21 16:12:40 -03:00
Roberto Ierusalimschy
6a5d87771f added lots of new comments + small changes in code 2014-05-15 16:27:33 -03:00
Roberto Ierusalimschy
6b630c0fa0 debug.numbits replaced by debug.Csize 2014-04-30 15:59:15 -03:00
Roberto Ierusalimschy
a3addae036 lua_gettable and similars return type of gotten value 2014-03-12 17:57:40 -03:00
Roberto Ierusalimschy
c86b9da022 userdata can have any Lua value as uservalue 2014-02-19 10:52:42 -03:00
Roberto Ierusalimschy
4244da96bf 'debug.subtype' -> 'math.type' (to distinguish integers and floats) 2013-07-22 13:05:53 -03:00
Roberto Ierusalimschy
fcf99bf788 'math.isfloat' replaced by 'debug.subtype' 2013-07-10 17:57:05 -03:00
Roberto Ierusalimschy
15fdbd26fe 'numbits' moved from 'math' to 'debug' library 2013-06-25 16:37:00 -03:00
Roberto Ierusalimschy
7dcc02b165 BUG: coroutine hooks were not collected together with coroutine 2012-01-19 18:14:44 -02:00
Roberto Ierusalimschy
af00a0772c new functions lua_rawsetp/lua_rawgetp 2011-10-24 12:54:05 -02:00
Roberto Ierusalimschy
19fbdf6cae 'luaL_findtable' -> 'luaL_getsubtable' 2011-04-08 16:17:36 -03:00
Roberto Ierusalimschy
c4ea0c3b29 detail (cleaning trailing spaces) 2011-01-26 14:30:02 -02:00
Roberto Ierusalimschy
c2e3cc4c89 using 'luaL_findtable' to manage hook table 2011-01-10 13:51:19 -02:00
Roberto Ierusalimschy
8d579c5bc5 'debug.setmetatable' returns object (like 'setmetatable') 2010-12-20 15:24:15 -02:00
Roberto Ierusalimschy
566758de79 'getuservalue' accepts any type of argument 2010-11-16 16:01:28 -02:00
Roberto Ierusalimschy
1b54197491 better error message when light userdata is used instead of a
full userdata
2010-11-10 16:06:10 -02:00
Roberto Ierusalimschy
8b7cf8c62d 'lua_[gs]etenv' -> 'lua_[gs]etuservalue' 2010-07-25 12:18:19 -03:00
Roberto Ierusalimschy
7192afafee new module policy: C modules do not create globals and do not register
themselves with 'require' (let 'require' do its work); new auxiliary
functions luaL_newlib/luaL_newlibtable/luaL_setfuncs/luaL_requiref.
Old luaL_register will be deprecated.
2010-07-02 08:38:13 -03:00