diffs-lua-5.5.0-lua-5.5.1
Makefile
39c39
< PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris
> PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
49c49
< R= $V.0
> R= $V.1
README
2c2
< This is Lua 5.5.0, released on 15 Dec 2025.
> This is Lua 5.5.1, released on 24 Jul 2026.
doc/contents.html
35c35
< Copyright © 2020–2025 Lua.org, PUC-Rio.
> Copyright © 2020–2026 Lua.org, PUC-Rio.
708c708
< Thu Dec 4 17:32:26 UTC 2025
> Mon Jul 13 21:19:58 UTC 2026
711c711
< Last change: revised for Lua 5.5.0
> Last change: revised for Lua 5.5.1
doc/manual.css
9a10,13
> pre.api {
> white-space: normal ;
> }
>
doc/manual.html
22c22
< Copyright © 2020–2025 Lua.org, PUC-Rio.
> Copyright © 2020–2026 Lua.org, PUC-Rio.
2103c2103
< foo() -- 'foo' can freely change any global
> foo() -- 'foo' can freely change any global
3266c3266,3280
< Several functions in the API return pointers (<code>const char*</code>)
> Several functions in the API have parameters
> that are pointers to C strings (<code>const char*</code>).
> Some of these parameters have an associated length (<code>size_t</code>).
> Unless stated otherwise,
> when there is an associated length,
> the string can contain embedded zeros;
> moreover, the pointer can be <code>NULL</code> if the length is zero.
> When there is no associated length,
> the pointer must point to a zero-terminated string.
> In any case, the string contents should remain unchanged
> until the function returns.
>
>
> <p>
> Several functions in the API also return pointers (<code>const char*</code>)
3675c3689
< <pre>int lua_absindex (lua_State *L, int idx);</pre>
> <pre class="api">int lua_absindex (lua_State *L, int idx);</pre>
3687c3701
< <pre>typedef void * (*lua_Alloc) (void *ud,
> <pre class="api">typedef void * (*lua_Alloc) (void *ud,
3766c3780
< <pre>void lua_arith (lua_State *L, int op);</pre>
> <pre class="api">void lua_arith (lua_State *L, int op);</pre>
3805c3819
< <pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre>
> <pre class="api">lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre>
3816c3830
< <pre>void lua_call (lua_State *L, int nargs, int nresults);</pre>
> <pre class="api">void lua_call (lua_State *L, int nargs, int nresults);</pre>
3889c3903
< <pre>void lua_callk (lua_State *L,
> <pre class="api">void lua_callk (lua_State *L,
3904c3918
< <pre>typedef int (*lua_CFunction) (lua_State *L);</pre>
> <pre class="api">typedef int (*lua_CFunction) (lua_State *L);</pre>
3956c3970
< <pre>int lua_checkstack (lua_State *L, int n);</pre>
> <pre class="api">int lua_checkstack (lua_State *L, int n);</pre>
3976c3990
< <pre>void lua_close (lua_State *L);</pre>
> <pre class="api">void lua_close (lua_State *L);</pre>
3998c4012
< <pre>void lua_closeslot (lua_State *L, int index);</pre>
> <pre class="api">void lua_closeslot (lua_State *L, int index);</pre>
4016c4030
< <pre>int lua_closethread (lua_State *L, lua_State *from);</pre>
> <pre class="api">int lua_closethread (lua_State *L, lua_State *from);</pre>
4051c4065
< <pre>int lua_compare (lua_State *L, int index1, int index2, int op);</pre>
> <pre class="api">int lua_compare (lua_State *L, int index1, int index2, int op);</pre>
4079c4093
< <pre>void lua_concat (lua_State *L, int n);</pre>
> <pre class="api">void lua_concat (lua_State *L, int n);</pre>
4096c4110
< <pre>void lua_copy (lua_State *L, int fromidx, int toidx);</pre>
> <pre class="api">void lua_copy (lua_State *L, int fromidx, int toidx);</pre>
4110c4124
< <pre>void lua_createtable (lua_State *L, int nseq, int nrec);</pre>
> <pre class="api">void lua_createtable (lua_State *L, int nseq, int nrec);</pre>
4129c4143
< <pre>int lua_dump (lua_State *L,
> <pre class="api">int lua_dump (lua_State *L,
4173c4187
< <pre>int lua_error (lua_State *L);</pre>
> <pre class="api">int lua_error (lua_State *L);</pre>
4188c4202
< <pre>int lua_gc (lua_State *L, int what, ...);</pre>
> <pre class="api">int lua_gc (lua_State *L, int what, ...);</pre>
4273c4287
< <pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre>
> <pre class="api">lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre>
4286c4300
< <pre>int lua_getfield (lua_State *L, int index, const char *k);</pre>
> <pre class="api">int lua_getfield (lua_State *L, int index, const char *k);</pre>
4304c4318
< <pre>void *lua_getextraspace (lua_State *L);</pre>
> <pre class="api">void *lua_getextraspace (lua_State *L);</pre>
4329c4343
< <pre>int lua_getglobal (lua_State *L, const char *name);</pre>
> <pre class="api">int lua_getglobal (lua_State *L, const char *name);</pre>
4341c4355
< <pre>int lua_geti (lua_State *L, int index, lua_Integer i);</pre>
> <pre class="api">int lua_geti (lua_State *L, int index, lua_Integer i);</pre>
4359c4373
< <pre>int lua_getmetatable (lua_State *L, int index);</pre>
> <pre class="api">int lua_getmetatable (lua_State *L, int index);</pre>
4373c4387
< <pre>int lua_gettable (lua_State *L, int index);</pre>
> <pre class="api">int lua_gettable (lua_State *L, int index);</pre>
4397c4411
< <pre>int lua_gettop (lua_State *L);</pre>
> <pre class="api">int lua_gettop (lua_State *L);</pre>
4411c4425
< <pre>int lua_getiuservalue (lua_State *L, int index, int n);</pre>
> <pre class="api">int lua_getiuservalue (lua_State *L, int index, int n);</pre>
4429c4443
< <pre>void lua_insert (lua_State *L, int index);</pre>
> <pre class="api">void lua_insert (lua_State *L, int index);</pre>
4442c4456
< <pre>typedef ... lua_Integer;</pre>
> <pre class="api">typedef ... lua_Integer;</pre>
4467c4481
< <pre>int lua_isboolean (lua_State *L, int index);</pre>
> <pre class="api">int lua_isboolean (lua_State *L, int index);</pre>
4479c4493
< <pre>int lua_iscfunction (lua_State *L, int index);</pre>
> <pre class="api">int lua_iscfunction (lua_State *L, int index);</pre>
4491c4505
< <pre>int lua_isfunction (lua_State *L, int index);</pre>
> <pre class="api">int lua_isfunction (lua_State *L, int index);</pre>
4503c4517
< <pre>int lua_isinteger (lua_State *L, int index);</pre>
> <pre class="api">int lua_isinteger (lua_State *L, int index);</pre>
4516c4530
< <pre>int lua_islightuserdata (lua_State *L, int index);</pre>
> <pre class="api">int lua_islightuserdata (lua_State *L, int index);</pre>
4528c4542
< <pre>int lua_isnil (lua_State *L, int index);</pre>
> <pre class="api">int lua_isnil (lua_State *L, int index);</pre>
4540c4554
< <pre>int lua_isnone (lua_State *L, int index);</pre>
> <pre class="api">int lua_isnone (lua_State *L, int index);</pre>
4552c4566
< <pre>int lua_isnoneornil (lua_State *L, int index);</pre>
> <pre class="api">int lua_isnoneornil (lua_State *L, int index);</pre>
4565c4579
< <pre>int lua_isnumber (lua_State *L, int index);</pre>
> <pre class="api">int lua_isnumber (lua_State *L, int index);</pre>
4578c4592
< <pre>int lua_isstring (lua_State *L, int index);</pre>
> <pre class="api">int lua_isstring (lua_State *L, int index);</pre>
4591c4605
< <pre>int lua_istable (lua_State *L, int index);</pre>
> <pre class="api">int lua_istable (lua_State *L, int index);</pre>
4603c4617
< <pre>int lua_isthread (lua_State *L, int index);</pre>
> <pre class="api">int lua_isthread (lua_State *L, int index);</pre>
4615c4629
< <pre>int lua_isuserdata (lua_State *L, int index);</pre>
> <pre class="api">int lua_isuserdata (lua_State *L, int index);</pre>
4627c4641
< <pre>int lua_isyieldable (lua_State *L);</pre>
> <pre class="api">int lua_isyieldable (lua_State *L);</pre>
4638c4652
< <pre>typedef ... lua_KContext;</pre>
> <pre class="api">typedef ... lua_KContext;</pre>
4653c4667
< <pre>typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);</pre>
> <pre class="api">typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);</pre>
4664c4678
< <pre>void lua_len (lua_State *L, int index);</pre>
> <pre class="api">void lua_len (lua_State *L, int index);</pre>
4678c4692
< <pre>int lua_load (lua_State *L,
> <pre class="api">int lua_load (lua_State *L,
4758c4772
< <pre>lua_State *lua_newstate (lua_Alloc f, void *ud,
> <pre class="api">lua_State *lua_newstate (lua_Alloc f, void *ud,
4779c4793
< <pre>void lua_newtable (lua_State *L);</pre>
> <pre class="api">void lua_newtable (lua_State *L);</pre>
4791c4805
< <pre>lua_State *lua_newthread (lua_State *L);</pre>
> <pre class="api">lua_State *lua_newthread (lua_State *L);</pre>
4811c4825
< <pre>void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue);</pre>
> <pre class="api">void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue);</pre>
4817,4818c4831,4838
< (The user values can be set and read with the functions
< <a href="#lua_setiuservalue"><code>lua_setiuservalue</code></a> and <a href="#lua_getiuservalue"><code>lua_getiuservalue</code></a>.)
>
>
> <p>
> The user values can be set and read with the functions
> <a href="#lua_setiuservalue"><code>lua_setiuservalue</code></a> and <a href="#lua_getiuservalue"><code>lua_getiuservalue</code></a>.
> The block of memory is suitably aligned for any ISO C object.
> (See macro <code>LUAI_MAXALIGN</code> in file <code>luaconf.h</code> for other
> alignment requirements.)
4834c4854
< <pre>int lua_next (lua_State *L, int index);</pre>
> <pre class="api">int lua_next (lua_State *L, int index);</pre>
4872,4873c4892,4895
< See function <a href="#pdf-next"><code>next</code></a> for the caveats of modifying
< the table during its traversal.
>
>
> <p>
> See function <a href="#pdf-next"><code>next</code></a> for more details about the traversal.
4880c4902
< <pre>typedef ... lua_Number;</pre>
> <pre class="api">typedef ... lua_Number;</pre>
4896c4918
< <pre>int lua_numbertointeger (lua_Number n, lua_Integer *p);</pre>
> <pre class="api">int lua_numbertointeger (lua_Number n, lua_Integer *p);</pre>
4918c4940
< <pre>unsigned lua_numbertocstring (lua_State *L, int idx,
> <pre class="api">unsigned lua_numbertocstring (lua_State *L, int idx,
4936c4958
< <pre>int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);</pre>
> <pre class="api">int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);</pre>
4986c5008
< <pre>int lua_pcallk (lua_State *L,
> <pre class="api">int lua_pcallk (lua_State *L,
5003c5025
< <pre>void lua_pop (lua_State *L, int n);</pre>
> <pre class="api">void lua_pop (lua_State *L, int n);</pre>
5015c5037
< <pre>void lua_pushboolean (lua_State *L, int b);</pre>
> <pre class="api">void lua_pushboolean (lua_State *L, int b);</pre>
5026c5048
< <pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre>
> <pre class="api">void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre>
5075c5097
< <pre>void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre>
> <pre class="api">void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre>
5087c5109
< <pre>const char *lua_pushexternalstring (lua_State *L,
> <pre class="api">const char *lua_pushexternalstring (lua_State *L,
5129c5151
< <pre>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre>
> <pre class="api">const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre>
5163c5185
< <pre>void lua_pushglobaltable (lua_State *L);</pre>
> <pre class="api">void lua_pushglobaltable (lua_State *L);</pre>
5174c5196
< <pre>void lua_pushinteger (lua_State *L, lua_Integer n);</pre>
> <pre class="api">void lua_pushinteger (lua_State *L, lua_Integer n);</pre>
5185c5207
< <pre>void lua_pushlightuserdata (lua_State *L, void *p);</pre>
> <pre class="api">void lua_pushlightuserdata (lua_State *L, void *p);</pre>
5206c5228
< <pre>const char *lua_pushliteral (lua_State *L, const char *s);</pre>
> <pre class="api">const char *lua_pushliteral (lua_State *L, const char *s);</pre>
5219c5241
< <pre>const char *lua_pushlstring (lua_State *L, const char *s, size_t len);</pre>
> <pre class="api">const char *lua_pushlstring (lua_State *L, const char *s, size_t len);</pre>
5245c5267
< <pre>void lua_pushnil (lua_State *L);</pre>
> <pre class="api">void lua_pushnil (lua_State *L);</pre>
5256c5278
< <pre>void lua_pushnumber (lua_State *L, lua_Number n);</pre>
> <pre class="api">void lua_pushnumber (lua_State *L, lua_Number n);</pre>
5267c5289
< <pre>const char *lua_pushstring (lua_State *L, const char *s);</pre>
> <pre class="api">const char *lua_pushstring (lua_State *L, const char *s);</pre>
5290c5312
< <pre>int lua_pushthread (lua_State *L);</pre>
> <pre class="api">int lua_pushthread (lua_State *L);</pre>
5302c5324
< <pre>void lua_pushvalue (lua_State *L, int index);</pre>
> <pre class="api">void lua_pushvalue (lua_State *L, int index);</pre>
5314c5336
< <pre>const char *lua_pushvfstring (lua_State *L,
> <pre class="api">const char *lua_pushvfstring (lua_State *L,
5332c5354
< <pre>int lua_rawequal (lua_State *L, int index1, int index2);</pre>
> <pre class="api">int lua_rawequal (lua_State *L, int index1, int index2);</pre>
5347c5369
< <pre>int lua_rawget (lua_State *L, int index);</pre>
> <pre class="api">int lua_rawget (lua_State *L, int index);</pre>
5360c5382
< <pre>int lua_rawgeti (lua_State *L, int index, lua_Integer n);</pre>
> <pre class="api">int lua_rawgeti (lua_State *L, int index, lua_Integer n);</pre>
5378c5400
< <pre>int lua_rawgetp (lua_State *L, int index, const void *p);</pre>
> <pre class="api">int lua_rawgetp (lua_State *L, int index, const void *p);</pre>
5397c5419
< <pre>lua_Unsigned lua_rawlen (lua_State *L, int index);</pre>
> <pre class="api">lua_Unsigned lua_rawlen (lua_State *L, int index);</pre>
5414c5436
< <pre>void lua_rawset (lua_State *L, int index);</pre>
> <pre class="api">void lua_rawset (lua_State *L, int index);</pre>
5427c5449
< <pre>void lua_rawseti (lua_State *L, int index, lua_Integer i);</pre>
> <pre class="api">void lua_rawseti (lua_State *L, int index, lua_Integer i);</pre>
5446c5468
< <pre>void lua_rawsetp (lua_State *L, int index, const void *p);</pre>
> <pre class="api">void lua_rawsetp (lua_State *L, int index, const void *p);</pre>
5465c5487
< <pre>typedef const char * (*lua_Reader) (lua_State *L,
> <pre class="api">typedef const char * (*lua_Reader) (lua_State *L,
5488c5510
< <pre>void lua_register (lua_State *L, const char *name, lua_CFunction f);</pre>
> <pre class="api">void lua_register (lua_State *L, const char *name, lua_CFunction f);</pre>
5504c5526
< <pre>void lua_remove (lua_State *L, int index);</pre>
> <pre class="api">void lua_remove (lua_State *L, int index);</pre>
5518c5540
< <pre>void lua_replace (lua_State *L, int index);</pre>
> <pre class="api">void lua_replace (lua_State *L, int index);</pre>
5532c5554
< <pre>int lua_resume (lua_State *L, lua_State *from, int nargs,
> <pre class="api">int lua_resume (lua_State *L, lua_State *from, int nargs,
5543c5565
< then you call <a href="#lua_resume"><code>lua_resume</code></a>,
> Then you call <a href="#lua_resume"><code>lua_resume</code></a>,
5581c5603
< <pre>void lua_rotate (lua_State *L, int idx, int n);</pre>
> <pre class="api">void lua_rotate (lua_State *L, int idx, int n);</pre>
5601c5623
< <pre>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre>
> <pre class="api">void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre>
5613c5635
< <pre>void lua_setfield (lua_State *L, int index, const char *k);</pre>
> <pre class="api">void lua_setfield (lua_State *L, int index, const char *k);</pre>
5632c5654
< <pre>void lua_setglobal (lua_State *L, const char *name);</pre>
> <pre class="api">void lua_setglobal (lua_State *L, const char *name);</pre>
5644c5666
< <pre>void lua_seti (lua_State *L, int index, lua_Integer n);</pre>
> <pre class="api">void lua_seti (lua_State *L, int index, lua_Integer n);</pre>
5663c5685
< <pre>int lua_setiuservalue (lua_State *L, int index, int n);</pre>
> <pre class="api">int lua_setiuservalue (lua_State *L, int index, int n);</pre>
5677c5699
< <pre>int lua_setmetatable (lua_State *L, int index);</pre>
> <pre class="api">int lua_setmetatable (lua_State *L, int index);</pre>
5695c5717
< <pre>void lua_settable (lua_State *L, int index);</pre>
> <pre class="api">void lua_settable (lua_State *L, int index);</pre>
5715c5737
< <pre>void lua_settop (lua_State *L, int index);</pre>
> <pre class="api">void lua_settop (lua_State *L, int index);</pre>
5735c5757
< <pre>void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud);</pre>
> <pre class="api">void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud);</pre>
5748c5770
< <pre>typedef struct lua_State lua_State;</pre>
> <pre class="api">typedef struct lua_State lua_State;</pre>
5769c5791
< <pre>int lua_status (lua_State *L);</pre>
> <pre class="api">int lua_status (lua_State *L);</pre>
5793,5794c5815,5816
< <span class="apii">[-0, +1, –]</span>
< <pre>size_t lua_stringtonumber (lua_State *L, const char *s);</pre>
> <span class="apii">[-0, +(0|1), –]</span>
> <pre class="api">size_t lua_stringtonumber (lua_State *L, const char *s);</pre>
5815c5837
< <pre>int lua_toboolean (lua_State *L, int index);</pre>
> <pre class="api">int lua_toboolean (lua_State *L, int index);</pre>
5833c5855
< <pre>lua_CFunction lua_tocfunction (lua_State *L, int index);</pre>
> <pre class="api">lua_CFunction lua_tocfunction (lua_State *L, int index);</pre>
5846c5868
< <pre>void lua_toclose (lua_State *L, int index);</pre>
> <pre class="api">void lua_toclose (lua_State *L, int index);</pre>
5888c5910
< <pre>lua_Integer lua_tointeger (lua_State *L, int index);</pre>
> <pre class="api">lua_Integer lua_tointeger (lua_State *L, int index);</pre>
5899c5921
< <pre>lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);</pre>
> <pre class="api">lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);</pre>
5920c5942
< <pre>const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre>
> <pre class="api">const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre>
5958c5980
< <pre>lua_Number lua_tonumber (lua_State *L, int index);</pre>
> <pre class="api">lua_Number lua_tonumber (lua_State *L, int index);</pre>
5969c5991
< <pre>lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);</pre>
> <pre class="api">lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);</pre>
5990c6012
< <pre>const void *lua_topointer (lua_State *L, int index);</pre>
> <pre class="api">const void *lua_topointer (lua_State *L, int index);</pre>
6010c6032
< <pre>const char *lua_tostring (lua_State *L, int index);</pre>
> <pre class="api">const char *lua_tostring (lua_State *L, int index);</pre>
6021c6043
< <pre>lua_State *lua_tothread (lua_State *L, int index);</pre>
> <pre class="api">lua_State *lua_tothread (lua_State *L, int index);</pre>
6035c6057
< <pre>void *lua_touserdata (lua_State *L, int index);</pre>
> <pre class="api">void *lua_touserdata (lua_State *L, int index);</pre>
6050c6072
< <pre>int lua_type (lua_State *L, int index);</pre>
> <pre class="api">int lua_type (lua_State *L, int index);</pre>
6074c6096
< <pre>const char *lua_typename (lua_State *L, int tp);</pre>
> <pre class="api">const char *lua_typename (lua_State *L, int tp);</pre>
6085c6107
< <pre>typedef ... lua_Unsigned;</pre>
> <pre class="api">typedef ... lua_Unsigned;</pre>
6096c6118
< <pre>int lua_upvalueindex (int i);</pre>
> <pre class="api">int lua_upvalueindex (int i);</pre>
6109c6131
< <pre>lua_Number lua_version (lua_State *L);</pre>
> <pre class="api">lua_Number lua_version (lua_State *L);</pre>
6119c6141
< <pre>typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);</pre>
> <pre class="api">typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);</pre>
6140c6162
< <pre>void lua_warning (lua_State *L, const char *msg, int tocont);</pre>
> <pre class="api">void lua_warning (lua_State *L, const char *msg, int tocont);</pre>
6156c6178
< <pre>typedef int (*lua_Writer) (lua_State *L,
> <pre class="api">typedef int (*lua_Writer) (lua_State *L,
6188c6210
< <pre>void lua_xmove (lua_State *from, lua_State *to, int n);</pre>
> <pre class="api">void lua_xmove (lua_State *from, lua_State *to, int n);</pre>
6204c6226
< <pre>int lua_yield (lua_State *L, int nresults);</pre>
> <pre class="api">int lua_yield (lua_State *L, int nresults);</pre>
6221c6243
< <pre>int lua_yieldk (lua_State *L,
> <pre class="api">int lua_yieldk (lua_State *L,
6244c6266
< with the <code>n</code> results removed and
> with all the results (<code>nresults</code>) removed and
6345c6367
< The length of the string <code>source</code>.
> the length of the string <code>source</code>.
6445c6467
< <pre>lua_Hook lua_gethook (lua_State *L);</pre>
> <pre class="api">lua_Hook lua_gethook (lua_State *L);</pre>
6456c6478
< <pre>int lua_gethookcount (lua_State *L);</pre>
> <pre class="api">int lua_gethookcount (lua_State *L);</pre>
6467c6489
< <pre>int lua_gethookmask (lua_State *L);</pre>
> <pre class="api">int lua_gethookmask (lua_State *L);</pre>
6478c6500
< <pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre>
> <pre class="api">int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre>
6531c6553
< fills in the fields <code>source</code>, <code>short_src</code>,
> fills in the fields <code>source</code>, <code>srclen</code>, <code>short_src</code>,
6564c6586
< <pre>const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);</pre>
> <pre class="api">const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);</pre>
6605c6627
< <pre>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre>
> <pre class="api">int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre>
6628c6650
< <pre>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre>
> <pre class="api">const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre>
6647c6669
< <pre>typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);</pre>
> <pre class="api">typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);</pre>
6696c6718
< <pre>void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre>
> <pre class="api">void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre>
6746c6768
< <pre>const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);</pre>
> <pre class="api">const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);</pre>
6762c6784,6786
< Parameters <code>ar</code> and <code>n</code> are as in the function <a href="#lua_getlocal"><code>lua_getlocal</code></a>.
> Parameters <code>ar</code> and <code>n</code> are as in the function <a href="#lua_getlocal"><code>lua_getlocal</code></a>,
> except that <code>ar</code> cannot be <code>NULL</code>,
> as <code>lua_setlocal</code> only operates on activation records.
6770c6794
< <pre>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre>
> <pre class="api">const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre>
6794c6818
< <pre>void *lua_upvalueid (lua_State *L, int funcindex, int n);</pre>
> <pre class="api">void *lua_upvalueid (lua_State *L, int funcindex, int n);</pre>
6820c6844
< <pre>void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
> <pre class="api">void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
6895c6919
< <pre>void luaL_addchar (luaL_Buffer *B, char c);</pre>
> <pre class="api">void luaL_addchar (luaL_Buffer *B, char c);</pre>
6907c6931
< <pre>const void luaL_addgsub (luaL_Buffer *B, const char *s,
> <pre class="api">const void luaL_addgsub (luaL_Buffer *B, const char *s,
6921c6945
< <pre>void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre>
> <pre class="api">void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre>
6935c6959
< <pre>void luaL_addsize (luaL_Buffer *B, size_t n);</pre>
> <pre class="api">void luaL_addsize (luaL_Buffer *B, size_t n);</pre>
6948c6972
< <pre>void luaL_addstring (luaL_Buffer *B, const char *s);</pre>
> <pre class="api">void luaL_addstring (luaL_Buffer *B, const char *s);</pre>
6961c6985
< <pre>void luaL_addvalue (luaL_Buffer *B);</pre>
> <pre class="api">void luaL_addvalue (luaL_Buffer *B);</pre>
6981c7005
< <pre>void luaL_argcheck (lua_State *L,
> <pre class="api">void luaL_argcheck (lua_State *L,
6996c7020
< <pre>int luaL_argerror (lua_State *L, int arg, const char *extramsg);</pre>
> <pre class="api">int luaL_argerror (lua_State *L, int arg, const char *extramsg);</pre>
7015c7039
< <pre>void luaL_argexpected (lua_State *L,
> <pre class="api">void luaL_argexpected (lua_State *L,
7030c7054
< <pre>typedef struct luaL_Buffer luaL_Buffer;</pre>
> <pre class="api">typedef struct luaL_Buffer luaL_Buffer;</pre>
7102c7126
< <pre>char *luaL_buffaddr (luaL_Buffer *B);</pre>
> <pre class="api">char *luaL_buffaddr (luaL_Buffer *B);</pre>
7115c7139
< <pre>void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre>
> <pre class="api">void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre>
7129c7153
< <pre>size_t luaL_bufflen (luaL_Buffer *B);</pre>
> <pre class="api">size_t luaL_bufflen (luaL_Buffer *B);</pre>
7141c7165
< <pre>char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);</pre>
> <pre class="api">char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);</pre>
7153c7177
< <pre>void luaL_buffsub (luaL_Buffer *B, int n);</pre>
> <pre class="api">void luaL_buffsub (luaL_Buffer *B, int n);</pre>
7166c7190
< <pre>int luaL_callmeta (lua_State *L, int obj, const char *e);</pre>
> <pre class="api">int luaL_callmeta (lua_State *L, int obj, const char *e);</pre>
7187c7211
< <pre>void luaL_checkany (lua_State *L, int arg);</pre>
> <pre class="api">void luaL_checkany (lua_State *L, int arg);</pre>
7199c7223
< <pre>lua_Integer luaL_checkinteger (lua_State *L, int arg);</pre>
> <pre class="api">lua_Integer luaL_checkinteger (lua_State *L, int arg);</pre>
7212c7236
< <pre>const char *luaL_checklstring (lua_State *L, int arg, size_t *l);</pre>
> <pre class="api">const char *luaL_checklstring (lua_State *L, int arg, size_t *l);</pre>
7231c7255
< <pre>lua_Number luaL_checknumber (lua_State *L, int arg);</pre>
> <pre class="api">lua_Number luaL_checknumber (lua_State *L, int arg);</pre>
7243c7267
< <pre>int luaL_checkoption (lua_State *L,
> <pre class="api">int luaL_checkoption (lua_State *L,
7274c7298
< <pre>void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre>
> <pre class="api">void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre>
7288c7312
< <pre>const char *luaL_checkstring (lua_State *L, int arg);</pre>
> <pre class="api">const char *luaL_checkstring (lua_State *L, int arg);</pre>
7305c7329
< <pre>void luaL_checktype (lua_State *L, int arg, int t);</pre>
> <pre class="api">void luaL_checktype (lua_State *L, int arg, int t);</pre>
7317c7341
< <pre>void *luaL_checkudata (lua_State *L, int arg, const char *tname);</pre>
> <pre class="api">void *luaL_checkudata (lua_State *L, int arg, const char *tname);</pre>
7330c7354
< <pre>void luaL_checkversion (lua_State *L);</pre>
> <pre class="api">void luaL_checkversion (lua_State *L);</pre>
7342c7366
< <pre>int luaL_dofile (lua_State *L, const char *filename);</pre>
> <pre class="api">int luaL_dofile (lua_State *L, const char *filename);</pre>
7361c7385
< <pre>int luaL_dostring (lua_State *L, const char *str);</pre>
> <pre class="api">int luaL_dostring (lua_State *L, const char *str);</pre>
7379c7403
< <pre>int luaL_error (lua_State *L, const char *fmt, ...);</pre>
> <pre class="api">int luaL_error (lua_State *L, const char *fmt, ...);</pre>
7402c7426
< <pre>int luaL_execresult (lua_State *L, int stat);</pre>
> <pre class="api">int luaL_execresult (lua_State *L, int stat);</pre>
7415c7439
< <pre>int luaL_fileresult (lua_State *L, int stat, const char *fname);</pre>
> <pre class="api">int luaL_fileresult (lua_State *L, int stat, const char *fname);</pre>
7428c7452
< <pre>int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre>
> <pre class="api">int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre>
7443c7467
< <pre>int luaL_getmetatable (lua_State *L, const char *tname);</pre>
> <pre class="api">int luaL_getmetatable (lua_State *L, const char *tname);</pre>
7457c7481
< <pre>int luaL_getsubtable (lua_State *L, int idx, const char *fname);</pre>
> <pre class="api">int luaL_getsubtable (lua_State *L, int idx, const char *fname);</pre>
7473c7497
< <pre>const char *luaL_gsub (lua_State *L,
> <pre class="api">const char *luaL_gsub (lua_State *L,
7490c7514
< <pre>lua_Integer luaL_len (lua_State *L, int index);</pre>
> <pre class="api">lua_Integer luaL_len (lua_State *L, int index);</pre>
7505c7529
< <pre>int luaL_loadbuffer (lua_State *L,
> <pre class="api">int luaL_loadbuffer (lua_State *L,
7519c7543
< <pre>int luaL_loadbufferx (lua_State *L,
> <pre class="api">int luaL_loadbufferx (lua_State *L,
7545c7569
< <pre>int luaL_loadfile (lua_State *L, const char *filename);</pre>
> <pre class="api">int luaL_loadfile (lua_State *L, const char *filename);</pre>
7556c7580
< <pre>int luaL_loadfilex (lua_State *L, const char *filename,
> <pre class="api">int luaL_loadfilex (lua_State *L, const char *filename,
7587c7611
< <pre>int luaL_loadstring (lua_State *L, const char *s);</pre>
> <pre class="api">int luaL_loadstring (lua_State *L, const char *s);</pre>
7609c7633
< <pre>unsigned int luaL_makeseed (lua_State *L);</pre>
> <pre class="api">unsigned int luaL_makeseed (lua_State *L);</pre>
7622c7646
< <pre>void luaL_newlib (lua_State *L, const luaL_Reg l[]);</pre>
> <pre class="api">void luaL_newlib (lua_State *L, const luaL_Reg l[]);</pre>
7644c7668
< <pre>void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);</pre>
> <pre class="api">void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);</pre>
7665c7689
< <pre>int luaL_newmetatable (lua_State *L, const char *tname);</pre>
> <pre class="api">int luaL_newmetatable (lua_State *L, const char *tname);</pre>
7682a7707,7716
> <p>
> Usage note: Beware the use of the return value of this function to
> conditionally initializes the new metatable
> (e.g., by adding metamethods to it).
> If the initialization raises an error,
> the metatable will not be properly initialized,
> but a subsequent execution of that code will detect that the
> metatable already exists and then skip the initialization.
>
>
7688c7722
< <pre>lua_State *luaL_newstate (void);</pre>
> <pre class="api">lua_State *luaL_newstate (void);</pre>
7709c7743
< <pre>T luaL_opt (L, func, arg, dflt);</pre>
> <pre class="api">T luaL_opt (L, func, arg, dflt);</pre>
7730c7764
< <pre>lua_Integer luaL_optinteger (lua_State *L,
> <pre class="api">lua_Integer luaL_optinteger (lua_State *L,
7748c7782
< <pre>const char *luaL_optlstring (lua_State *L,
> <pre class="api">const char *luaL_optlstring (lua_State *L,
7779c7813
< <pre>lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);</pre>
> <pre class="api">lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);</pre>
7794c7828
< <pre>const char *luaL_optstring (lua_State *L,
> <pre class="api">const char *luaL_optstring (lua_State *L,
7811c7845
< <pre>char *luaL_prepbuffer (luaL_Buffer *B);</pre>
> <pre class="api">char *luaL_prepbuffer (luaL_Buffer *B);</pre>
7823c7857
< <pre>char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);</pre>
> <pre class="api">char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);</pre>
7839c7873
< <pre>void luaL_pushfail (lua_State *L);</pre>
> <pre class="api">void luaL_pushfail (lua_State *L);</pre>
7850c7884
< <pre>void luaL_pushresult (luaL_Buffer *B);</pre>
> <pre class="api">void luaL_pushresult (luaL_Buffer *B);</pre>
7862c7896
< <pre>void luaL_pushresultsize (luaL_Buffer *B, size_t sz);</pre>
> <pre class="api">void luaL_pushresultsize (luaL_Buffer *B, size_t sz);</pre>
7873c7907
< <pre>int luaL_ref (lua_State *L, int t);</pre>
> <pre class="api">int luaL_ref (lua_State *L, int t);</pre>
7913c7947
< <pre>typedef struct luaL_Reg {
> <pre class="api">typedef struct luaL_Reg {
7932c7966
< <pre>void luaL_requiref (lua_State *L, const char *modname,
> <pre class="api">void luaL_requiref (lua_State *L, const char *modname,
7956c7990
< <pre>void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);</pre>
> <pre class="api">void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);</pre>
7983c8017
< <pre>void luaL_setmetatable (lua_State *L, const char *tname);</pre>
> <pre class="api">void luaL_setmetatable (lua_State *L, const char *tname);</pre>
7995c8029
< <pre>void *luaL_alloc (void *ud, void *ptr, size_t osize, size_t nsize);</pre>
> <pre class="api">void *luaL_alloc (void *ud, void *ptr, size_t osize, size_t nsize);</pre>
8006c8040
< <pre>typedef struct luaL_Stream {
> <pre class="api">typedef struct luaL_Stream {
8045c8079
< <pre>void *luaL_testudata (lua_State *L, int arg, const char *tname);</pre>
> <pre class="api">void *luaL_testudata (lua_State *L, int arg, const char *tname);</pre>
8058c8092
< <pre>const char *luaL_tolstring (lua_State *L, int idx, size_t *len);</pre>
> <pre class="api">const char *luaL_tolstring (lua_State *L, int idx, size_t *len);</pre>
8081c8115
< <pre>void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
> <pre class="api">void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
8097c8131
< <pre>int luaL_typeerror (lua_State *L, int arg, const char *tname);</pre>
> <pre class="api">int luaL_typeerror (lua_State *L, int arg, const char *tname);</pre>
8112c8146
< <pre>const char *luaL_typename (lua_State *L, int index);</pre>
> <pre class="api">const char *luaL_typename (lua_State *L, int index);</pre>
8123c8157
< <pre>void luaL_unref (lua_State *L, int t, int ref);</pre>
> <pre class="api">void luaL_unref (lua_State *L, int t, int ref);</pre>
8143c8177
< <pre>void luaL_where (lua_State *L, int lvl);</pre>
> <pre class="api">void luaL_where (lua_State *L, int lvl);</pre>
8258c8292
< <pre>void luaL_openlibs (lua_State *L);</pre>
> <pre class="api">void luaL_openlibs (lua_State *L);</pre>
8269c8303
< <pre>void luaL_openselectedlibs (lua_State *L, int load, int preload);</pre>
> <pre class="api">void luaL_openselectedlibs (lua_State *L, int load, int preload);</pre>
8657,8658c8691
< See function <a href="#pdf-next"><code>next</code></a> for the caveats of modifying
< the table during its traversal.
> See function <a href="#pdf-next"><code>next</code></a> for more details about the traversal.
11683a11717,11719
>
>
> <p>
11692a11729,11730
> It is good practice to always require this library explicitly
> before using it.
12308a12347,12351
>
>
> <p>
> The compilation option <code>LUA_COMPAT_GLOBAL</code> (see <code>luaconf.h</code>)
> makes <code>global</code> a regular word.
12438c12481
< <b>global</b> attnamelist |
> <b>global</b> attnamelist [‘<b>=</b>’ explist] |
12502c12545
< Mon Dec 15 21:02:05 UTC 2025
> Fri Jul 24 14:07:32 UTC 2026
12505c12548
< Last change: revised for Lua 5.5.0
> Last change: revised for Lua 5.5.1
doc/readme.html
112c112
< the top-level directory, which is named <TT>lua-5.5.0</TT>.
> the top-level directory, which is named <TT>lua-5.5.1</TT>.
265a266
> <LI> named vararg tables
299c300
< Copyright © 1994–2025 Lua.org, PUC-Rio.
> Copyright © 1994–2026 Lua.org, PUC-Rio.
326c327
< Wed Dec 10 11:37:23 UTC 2025
> Mon Jul 13 21:20:24 UTC 2026
329c330
< Last change: revised for Lua 5.5.0
> Last change: revised for Lua 5.5.1
src/Makefile
33c33
< PLATS= guess aix bsd c89 freebsd generic ios linux macosx mingw posix solaris
> PLATS= guess aix bsd c89 freebsd generic ios linux linux-readline macosx mingw posix solaris
125a126,128
> linux-readline:
> $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE" SYSLIBS="-Wl,-E -ldl -lreadline"
>
127c130
< $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
> $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
src/lapi.c
190c190
< setnilvalue(s2v(L->top.p++)); /* clear new slots */
> setnilvalue2s(L->top.p++); /* clear new slots */
213c213
< setnilvalue(s2v(level));
> setnilvalue2s(level);
369c369
< LUA_API unsigned (lua_numbertocstring) (lua_State *L, int idx, char *buff) {
> LUA_API unsigned lua_numbertocstring (lua_State *L, int idx, char *buff) {
516c516
< setnilvalue(s2v(L->top.p));
> setnilvalue2s(L->top.p);
573c573
< setnilvalue(s2v(L->top.p));
> setnilvalue2s(L->top.p);
746c746
< setnilvalue(s2v(L->top.p));
> setnilvalue2s(L->top.p);
839c839
< setnilvalue(s2v(L->top.p));
> setnilvalue2s(L->top.p);
1124a1125
> luaC_checkGC(L);
1203a1205
> l_mem newdebt;
1207,1208c1209,1214
< n = g->GCdebt; /* force to run one basic step */
< luaE_setdebt(g, g->GCdebt - n);
> newdebt = 0; /* force to run one basic step */
> else if (g->GCdebt >= n - MAX_LMEM) /* no overflow? */
> newdebt = g->GCdebt - n;
> else /* overflow */
> newdebt = -MAX_LMEM; /* set debt to mininum value */
> luaE_setdebt(g, newdebt);
1296d1301
< api_checknelems(L, n);
1297a1303
> api_checkpop(L, n);
1415c1421
< api_checknelems(L, 1);
> api_checkpop(L, 1);
src/lauxlib.c
515a516,529
> /*
> ** Get/create metatable (MT) for boxes
> */
> static void getBoxMT (lua_State *L) {
> const char *BOXMT = "_UBOX*"; /* key for the metatable */
> if (luaL_getmetatable(L, BOXMT) == LUA_TNIL) { /* MT not created yet? */
> luaL_newlibtable(L, boxmt); /* create it */
> luaL_setfuncs(L, boxmt, 0); /* initialize it */
> lua_copy(L, -1, -2); /* change stack from nil,MT to MT,MT */
> lua_setfield(L, LUA_REGISTRYINDEX, BOXMT); /* store MT in the registry */
> }
> }
>
>
520,521c534
< if (luaL_newmetatable(L, "_UBOX*")) /* creating metatable? */
< luaL_setfuncs(L, boxmt, 0); /* set its metamethods */
> getBoxMT(L);
877c890
< return luaL_loadbuffer(L, s, strlen(s), s);
> return luaL_loadbufferx(L, s, strlen(s), s, "t");
src/lauxlib.h
84,85c84,85
< LUALIB_API void *luaL_alloc (void *ud, void *ptr, size_t osize,
< size_t nsize);
> LUALIB_API void *(luaL_alloc) (void *ud, void *ptr, size_t osize,
> size_t nsize);
106c106
< LUALIB_API unsigned luaL_makeseed (lua_State *L);
> LUALIB_API unsigned (luaL_makeseed) (lua_State *L);
src/lbaselib.c
343,344c343,345
< const char *mode = luaL_optstring(L, idx, "bt");
< if (strchr(mode, 'B') != NULL) /* Lua code cannot use fixed buffers */
> const char *mode = luaL_optstring(L, idx, NULL);
> if (mode != NULL && strchr(mode, 'B') != NULL) {
> /* Lua code cannot use fixed buffers */
345a347
> }
367,378c369
< ** reserved slot, above all arguments, to hold a copy of the returned
< ** string to avoid it being collected while parsed. 'load' has four
< ** optional arguments (chunk, source name, mode, and environment).
< */
< #define RESERVEDSLOT 5
<
<
< /*
< ** Reader for generic 'load' function: 'lua_load' uses the
< ** stack for internal stuff, so the reader cannot change the
< ** stack top. Instead, it keeps its resulting string in a
< ** reserved slot inside the stack.
> ** Reader for generic 'load' function.
381c372
< (void)(ud); /* not used */
> int *firstcall = cast(int *, ud);
382a374,377
> if (*firstcall)
> *firstcall = 0;
> else
> lua_pop(L, 1); /* remove previous result */
386d380
< lua_pop(L, 1); /* pop result */
392,393c386
< lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */
< return lua_tolstring(L, RESERVEDSLOT, size);
> return lua_tolstring(L, -1, size);
407a401
> int firstcall = 1; /* userdata for generic_reader */
410,411c404
< lua_settop(L, RESERVEDSLOT); /* create reserved slot */
< status = lua_load(L, generic_reader, NULL, chunkname, mode);
> status = lua_load(L, generic_reader, &firstcall, chunkname, mode);
428c421
< if (l_unlikely(luaL_loadfile(L, fname) != LUA_OK))
> if (l_unlikely(luaL_loadfilex(L, fname, "bt") != LUA_OK))
src/lcode.c
666,667c666,667
< TValue k, v;
< setnilvalue(&v);
> lua_State *L = fs->ls->L;
> TValue k;
669,670c669,670
< sethvalue(fs->ls->L, &k, fs->kcache);
< return k2proto(fs, &k, &v);
> sethvalue(L, &k, fs->kcache);
> return k2proto(fs, &k, &G(L)->nilvalue);
830c830
< e->u.info = temp; /* (can't do a direct assignment; values overlap) */
> e->u.info = temp; /* (avoid a direct assignment; values overlap) */
1368c1368
< t->u.ind.t = temp; /* (can't do a direct assignment; values overlap) */
> t->u.ind.t = temp; /* (avoid a direct assignment; values overlap) */
1376c1376
< t->u.ind.t = vreg; /* (avoid a direct assignment; values may overlap) */
> t->u.ind.t = vreg; /* (avoid a direct assignment; values may overlap?) */
1381c1381,1382
< t->u.ind.t = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info);
> lu_byte temp = cast_byte((t->k == VLOCAL) ? t->u.var.ridx: t->u.info);
> t->u.ind.t = temp; /* (avoid a direct assignment; values may overlap?) */
1936,1937d1936
< /* avoid "not used" warnings when assert is off (for 'onelua.c') */
< (void)luaP_isOT; (void)luaP_isIT;
src/ldblib.c
430c430
< if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
> if (luaL_loadbufferx(L, buffer, strlen(buffer), "=(debug command)", "t") ||
src/ldebug.c
294c294
< setnilvalue(s2v(L->top.p));
> setnilvalue2s(L->top.p);
583c583
< case OP_GETTABLE: {
> case OP_GETTABLE: case OP_GETVARG: {
src/ldo.c
224,226c224,226
< ** Check whether stack has enough space to run a simple function (such
< ** as a finalizer): At least BASIC_STACK_SIZE in the Lua stack and
< ** 2 slots in the C stack.
> ** Check whether stacks have enough space to run a simple function (such
> ** as a finalizer): At least BASIC_STACK_SIZE in the Lua stack, two
> ** available CallInfos, and two "slots" in the C stack.
229,230c229,238
< return ((stacksize(L) < MAXSTACK - BASIC_STACK_SIZE) &&
< (getCcalls(L) < LUAI_MAXCCALLS - 2));
> if (getCcalls(L) >= LUAI_MAXCCALLS - 2)
> return 0; /* not enough C-stack slots */
> if (L->ci->next == NULL && luaE_extendCI(L, 0) == NULL)
> return 0; /* unable to allocate first ci */
> if (L->ci->next->next == NULL && luaE_extendCI(L, 0) == NULL)
> return 0; /* unable to allocate second ci */
> if (L->stack_last.p - L->top.p >= BASIC_STACK_SIZE)
> return 1; /* enough (BASIC_STACK_SIZE) free slots in the Lua stack */
> else /* try to grow stack to a size with enough free slots */
> return luaD_growstack(L, BASIC_STACK_SIZE, 0);
344c352
< setnilvalue(s2v(newstack + i)); /* erase new segment */
> setnilvalue2s(newstack + i); /* erase new segment */
425,430d432
<
< void luaD_inctop (lua_State *L) {
< L->top.p++;
< luaD_checkstack(L, 1);
< }
<
549c551
< setnilvalue(s2v(res + i));
> setnilvalue2s(res + i);
569c571
< setnilvalue(s2v(res)); /* adjust with nil */
> setnilvalue2s(res); /* adjust with nil */
619c621
< #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L))
> #define next_ci(L) (L->ci->next ? L->ci->next : luaE_extendCI(L, 1))
689c691
< setnilvalue(s2v(func + narg1)); /* complete missing arguments */
> setnilvalue2s(func + narg1); /* complete missing arguments */
736c738
< setnilvalue(s2v(L->top.p++)); /* complete missing arguments */
> setnilvalue2s(L->top.p++); /* complete missing arguments */
1122a1125,1128
> /*
> ** Before the first call to the reader function, Lua reserves a slot
> ** with a table for anchoring stuff.
> */
1127c1133,1139
< int c = zgetc(p->z); /* read first character */
> int c;
> Table *anchor;
> ptrdiff_t otop = savestack(L, L->top.p); /* original top */
> luaD_checkstack(L, 2);
> anchor = luaH_new(L); /* create the anchor table */
> sethvalue2s(L, L->top.p++, anchor); /* anchor the anchor table */
> c = zgetc(p->z); /* read first character */
1134c1146
< cl = luaU_undump(L, p->z, p->name, fixed);
> cl = luaU_undump(L, p->z, anchor, p->name, fixed);
1138c1150
< cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
> cl = luaY_parser(L, p->z, anchor, &p->buff, &p->dyd, p->name, c);
1139a1152,1153
> L->top.p = restorestack(L, otop); /* restore stack */
> setclLvalue2s(L, L->top.p++, cl); /* push closure */
1141a1156,1169
> }
>
>
> /*
> ** Anchor an object in a table in the stack. First, anchor the object
> ** temporarily in the stack, as luaH_set may call an emergency GC.
> ** Then, add it in the table with itself as its key.
> */
> void luaD_anchorobj (lua_State *L, Table *anchor, GCObject *obj) {
> setgcovalue(L, s2v(L->top.p++), obj); /* temporary anchor in the stack */
> luaH_set(L, anchor, s2v(L->top.p - 1), s2v(L->top.p - 1));
> /* Because this is a new key, luaH_set will call the GC barrier, so
> we don't need to call the barrier again here */
> L->top.p--;
src/ldo.h
91d90
< LUAI_FUNC void luaD_inctop (lua_State *L);
92a92
> LUAI_FUNC void luaD_anchorobj (lua_State *L, Table *anchor, GCObject *obj);
src/lgc.c
712c712
< setnilvalue(s2v(o)); /* clear dead stack slice */
> setnilvalue2s(o); /* clear dead stack slice */
1296c1296
< if (!g->gcemergency && luaD_checkminstack(L))
> if (g->tobefnz != NULL && !g->gcemergency && luaD_checkminstack(L))
1675c1675
< else { /* no more finalizers or emergency mode or no enough stack
> else { /* no more finalizers or emergency mode or not enough stack
src/llex.c
191c191
< #if defined(LUA_COMPAT_GLOBAL)
> #if LUA_COMPAT_GLOBAL
src/llimits.h
237c237
< #define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b)))
> #define luai_numidiv(L,a,b) l_floor(luai_numdiv(L,a,b))
242c242
< #define luai_numdiv(L,a,b) ((a)/(b))
> #define luai_numdiv(L,a,b) ((void)L, (a)/(b))
270,273c270,273
< #define luai_numadd(L,a,b) ((a)+(b))
< #define luai_numsub(L,a,b) ((a)-(b))
< #define luai_nummul(L,a,b) ((a)*(b))
< #define luai_numunm(L,a) (-(a))
> #define luai_numadd(L,a,b) ((void)L, (a)+(b))
> #define luai_numsub(L,a,b) ((void)L, (a)-(b))
> #define luai_nummul(L,a,b) ((void)L, (a)*(b))
> #define luai_numunm(L,a) ((void)L, -(a))
src/loadlib.c
544c544
< return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename);
> return checkload(L, (luaL_loadfilex(L, filename, "bt") == LUA_OK), filename);
src/lobject.h
211c211,212
< #define setnilvalue(obj) settt_(obj, LUA_VNIL)
> #define setnilvalue(obj) settt_(obj, LUA_VNIL)
> #define setnilvalue2s(stk) setnilvalue(s2v(stk))
src/lopcodes.c
107c107
< ,opmode(0, 0, 1, 0, 1, iABC) /* OP_VARARGPREP */
> ,opmode(0, 0, 0, 0, 0, iABC) /* OP_VARARGPREP */
112,124c112
<
< /*
< ** Check whether instruction sets top for next instruction, that is,
< ** it results in multiple values.
< */
< int luaP_isOT (Instruction i) {
< OpCode op = GET_OPCODE(i);
< switch (op) {
< case OP_TAILCALL: return 1;
< default:
< return testOTMode(op) && GETARG_C(i) == 0;
< }
< }
> #define testITMode(m) (luaP_opmodes[m] & (1 << 5))
128,129c116,118
< ** Check whether instruction uses top from previous instruction, that is,
< ** it accepts multiple results.
> ** Check whether instruction uses top. That happens for OP_VARARGPREP
> ** and for instructions that use multiple values set by the previous
> ** instruction.
135c124,126
< return testITMode(GET_OPCODE(i)) && GETARG_vB(i) == 0;
> return GETARG_vB(i) == 0;
> case OP_VARARGPREP:
> return 1;
src/lopcodes.h
420,421c420,421
< ** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0)
< ** bit 6: instruction sets 'L->top' for next instruction (when C == 0)
> ** bit 5: used by 'luaP_isIT'
> ** bit 6: used by 'luaP_isOT'
430,431d429
< #define testITMode(m) (luaP_opmodes[m] & (1 << 5))
< #define testOTMode(m) (luaP_opmodes[m] & (1 << 6))
435c433,440
< LUAI_FUNC int luaP_isOT (Instruction i);
> /* Check whether instruction sets top for next instruction, that is,
> ** it results in multiple values. Used only for tests.
> */
> #define luaP_isOT(i) \
> (GET_OPCODE(i) == OP_TAILCALL || \
> ((luaP_opmodes[GET_OPCODE(i)] & (1 << 6)) && GETARG_C(i) == 0))
>
>
src/lparser.c
824,825c824
< sethvalue2s(L, L->top.p, fs->kcache); /* anchor it */
< luaD_inctop(L);
> luaD_anchorobj(L, ls->h, obj2gco(fs->kcache)); /* anchor it */
833a833
> TValue temp;
845a846,848
> /* remove kcache table from scanner table ("weigh" its anchor) */
> sethvalue(L, &temp, fs->kcache); /* key to be set to nil */
> luaH_set(L, ls->h, &temp, &G(L)->nilvalue);
847d849
< L->top.p--; /* pop kcache table */
1166a1169
> return; /* to avoid warnings */
1614d1616
< leaveblock(fs); /* finish scope */
1622a1625
> leaveblock(fs); /* finish scope */
2114c2117
< #if defined(LUA_COMPAT_GLOBAL)
> #if LUA_COMPAT_GLOBAL
2168c2171
< LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
> LClosure *luaY_parser (lua_State *L, ZIO *z, Table *anchor, Mbuffer *buff,
2172,2177c2175,2178
< LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */
< setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */
< luaD_inctop(L);
< lexstate.h = luaH_new(L); /* create table for scanner */
< sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */
< luaD_inctop(L);
> LClosure *cl;
> lexstate.h = anchor; /* table for scanner */
> cl = luaF_newLclosure(L, 1); /* create main closure */
> luaD_anchorobj(L, anchor, obj2gco(cl)); /* anchor it in scanner table */
2190,2191c2191
< L->top.p--; /* remove scanner's table */
< return cl; /* closure is on the stack, too */
> return cl;
src/lparser.h
192,193c192,194
< LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
< Dyndata *dyd, const char *name, int firstchar);
> LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Table *anchor,
> Mbuffer *buff, Dyndata *dyd,
> const char *name, int firstchar);
src/lstate.c
71c71
< CallInfo *luaE_extendCI (lua_State *L) {
> CallInfo *luaE_extendCI (lua_State *L, int err) {
73,76c73,79
< lua_assert(L->ci->next == NULL);
< ci = luaM_new(L, CallInfo);
< lua_assert(L->ci->next == NULL);
< L->ci->next = ci;
> ci = luaM_reallocvector(L, NULL, 0, 1, CallInfo);
> if (l_unlikely(ci == NULL)) { /* allocation failed? */
> if (err)
> luaM_error(L); /* raise the error */
> return NULL; /* else only report it */
> }
> ci->next = L->ci->next;
78c81,83
< ci->next = NULL;
> L->ci->next = ci;
> if (ci->next)
> ci->next->previous = ci;
149c154
< setnilvalue(s2v(ci->func.p)); /* 'function' entry for basic 'ci' */
> setnilvalue2s(ci->func.p); /* 'function' entry for basic 'ci' */
164c169
< setnilvalue(s2v(L1->stack.p + i)); /* erase new stack */
> setnilvalue2s(L1->stack.p + i); /* erase new stack */
src/lstate.h
386c386
< ** Union of all collectable objects (only for conversions)
> ** Union of all collectable objects
406,409c406,412
< /*
< ** ISO C99, 6.7.2.1 p.14:
< ** "A pointer to a union object, suitably converted, points to each of
< ** its members [...], and vice versa."
> /* macros to convert a GCObject into a specific value
> ** ISO C99, 6.3.2.2 p.7:
> ** "A pointer to an object or incomplete type may be converted to a
> ** pointer to a different object or incomplete type. If the resulting
> ** pointer is not correctly aligned for the pointed-to type, the
> ** behavior is undefined. Otherwise, when converted back again, the
> ** result shall compare equal to the original pointer."
411,424c414,424
< #define cast_u(o) cast(union GCUnion *, (o))
<
< /* macros to convert a GCObject into a specific value */
< #define gco2ts(o) \
< check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts))
< #define gco2u(o) check_exp((o)->tt == LUA_VUSERDATA, &((cast_u(o))->u))
< #define gco2lcl(o) check_exp((o)->tt == LUA_VLCL, &((cast_u(o))->cl.l))
< #define gco2ccl(o) check_exp((o)->tt == LUA_VCCL, &((cast_u(o))->cl.c))
< #define gco2cl(o) \
< check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl))
< #define gco2t(o) check_exp((o)->tt == LUA_VTABLE, &((cast_u(o))->h))
< #define gco2p(o) check_exp((o)->tt == LUA_VPROTO, &((cast_u(o))->p))
< #define gco2th(o) check_exp((o)->tt == LUA_VTHREAD, &((cast_u(o))->th))
< #define gco2upv(o) check_exp((o)->tt == LUA_VUPVAL, &((cast_u(o))->upv))
> #define gco2(v,T,o) check_exp((o)->tt == v, cast(T*, o))
> #define gco2nv(t,T,o) check_exp(novariant((o)->tt) == t, cast(T*, o))
> #define gco2ts(o) gco2nv(LUA_TSTRING, TString, o)
> #define gco2u(o) gco2(LUA_VUSERDATA, Udata, o)
> #define gco2lcl(o) (&gco2(LUA_VLCL, Closure, o)->l)
> #define gco2ccl(o) (&gco2(LUA_VCCL, Closure, o)->c)
> #define gco2cl(o) gco2nv(LUA_TFUNCTION, Closure, o)
> #define gco2t(o) gco2(LUA_VTABLE, Table, o)
> #define gco2p(o) gco2(LUA_VPROTO, Proto, o)
> #define gco2th(o) gco2(LUA_VTHREAD, lua_State, o)
> #define gco2upv(o) gco2(LUA_VUPVAL, UpVal, o)
431c431
< check_exp(novariant((v)->tt) >= LUA_TSTRING, &(cast_u(v)->gc))
> check_exp(novariant((v)->tt) >= LUA_TSTRING, cast(GCObject*, v))
441c441
< LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L);
> LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L, int err);
src/lstrlib.c
144,145c144,145
< if (n <= 0)
< lua_pushliteral(L, "");
> if (n <= 0 || (len | lsep) == 0)
> lua_pushliteral(L, ""); /* no repetitions or both strings empty */
759a760,762
> /*
> ** Prepare state for matches. These fields are not affected by each match.
> */
763d765
< ms->matchdepth = MAXCCALLS;
769a772,775
> /*
> ** (Re)prepare state for a match, setting fields that change during
> ** each match.
> */
770a777
> ms->matchdepth = MAXCCALLS;
772d778
< lua_assert(ms->matchdepth == MAXCCALLS);
971c977
< changed = add_value(&ms, &b, src, e, tr) | changed;
> changed = add_value(&ms, &b, src, e, tr) || changed;
1729c1735
< luaL_argcheck(L, totalsize <= LUA_MAXINTEGER - size,
> luaL_argcheck(L, totalsize <= MAX_SIZE - size,
src/ltable.c
654,657c654,656
< ** Exchange the hash part of 't1' and 't2'. (In 'flags', only the
< ** dummy bit must be exchanged: The 'isrealasize' is not related
< ** to the hash part, and the metamethod bits do not change during
< ** a resize, so the "real" table can keep their values.)
> ** Exchange the hash part of 't1' and 't2'. (In 'flags', only the dummy
> ** bit must be exchanged: The metamethod bits do not change during a
> ** resize, so the "real" table can keep their values.)
1158a1158
> const TValue *actk = key; /* actual key to insert */
1164,1166c1164,1166
< if (luaV_flttointeger(f, &k, F2Ieq)) {
< setivalue(&aux, k); /* key is equal to an integer */
< key = &aux; /* insert it as an integer */
> if (luaV_flttointeger(f, &k, F2Ieq)) { /* is key equal to an integer? */
> setivalue(&aux, k);
> actk = &aux; /* use the integer as the key */
1179c1179
< luaH_newkey(L, t, key, value);
> luaH_newkey(L, t, actk, value);
src/ltablib.c
45c45
< ** has a metatable with the required metamethods)
> ** has a metatable with the required metamethods).
48c48,49
< if (lua_type(L, arg) != LUA_TTABLE) { /* is it not a table? */
> int tp = lua_type(L, arg);
> if (tp != LUA_TTABLE) { /* is it not a table? */
53c54,55
< (!(what & TAB_L) || checkfield(L, "__len", ++n))) {
> (!(what & TAB_L) || /* strings don't need '__len' to have a length */
> tp == LUA_TSTRING || checkfield(L, "__len", ++n))) {
206a209
> lua_Integer len = aux_getn(L, 1, TAB_R);
208c211
< lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1));
> lua_Integer e = luaL_opt(L, luaL_checkinteger, 3, len);
src/ltm.c
265c265
< setnilvalue(s2v(ci->func.p + i)); /* erase original parameter (for GC) */
> setnilvalue2s(ci->func.p + i); /* erase original parameter (for GC) */
286c286
< setnilvalue(s2v(ci->func.p + nfixparams + 1));
> setnilvalue2s(ci->func.p + nfixparams + 1);
310c310
< setnilvalue(s2v(ra)); /* else produce nil */
> setnilvalue2s(ra); /* else produce nil */
358c358
< setnilvalue(s2v(where + i));
> setnilvalue2s(where + i);
362c362
< setnilvalue(s2v(where + i));
> setnilvalue2s(where + i);
src/ltm.h
52c52
< ** the table is using the dummy node; bit 7 is used for 'isrealasize'.)
> ** the table is using the dummy node.)
src/lua.c
32a33,38
> /* Name of the environment variable with the name of the readline library */
> #if !defined(LUA_RLLIB_VAR)
> #define LUA_RLLIB_VAR "LUA_READLINELIB"
> #endif
>
>
204c210
< return dochunk(L, luaL_loadfile(L, name));
> return dochunk(L, luaL_loadfilex(L, name, "bt"));
209c215
< return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name));
> return dochunk(L, luaL_loadbufferx(L, s, strlen(s), name, "t"));
263c269
< status = luaL_loadfile(L, fname);
> status = luaL_loadfilex(L, fname, "bt");
376a383,391
> static char *(*l_getenv)(const char *name);
>
> /* Function to ignore environment variables, used by option -E */
> static char *no_getenv (const char *name) {
> UNUSED(name);
> return NULL;
> }
>
>
379c394
< const char *init = getenv(name + 1);
> const char *init = l_getenv(name + 1);
382c397
< init = getenv(name + 1); /* try alternative name */
> init = l_getenv(name + 1); /* try alternative name */
501,504c516,521
< void *lib = dlopen(LUA_READLINELIB, RTLD_NOW | RTLD_LOCAL);
< if (lib == NULL)
< lua_warning(L, "library '" LUA_READLINELIB "' not found", 0);
< else {
> const char *rllib = l_getenv(LUA_RLLIB_VAR); /* name of readline library */
> void *lib; /* library handle */
> if (rllib == NULL) /* no environment variable? */
> rllib = LUA_READLINELIB; /* use default name */
> lib = dlopen(rllib, RTLD_NOW | RTLD_LOCAL);
> if (lib != NULL) {
510,512c527,533
< if (l_readline == NULL)
< lua_warning(L, "unable to load 'readline'", 0);
< }
> if (l_readline != NULL) /* could load readline function? */
> return; /* everything ok */
> /* else emit a warning */
> }
> lua_warning(L, "unable to load readline library '", 1);
> lua_warning(L, rllib, 1);
> lua_warning(L, "'", 0);
591c612
< int status = luaL_loadbuffer(L, retline, strlen(retline), "=stdin");
> int status = luaL_loadbufferx(L, retline, strlen(retline), "=stdin", "t");
595c616
< lua_pop(L, 2); /* pop result from 'luaL_loadbuffer' and modified line */
> lua_pop(L, 2); /* pop result from 'luaL_loadbufferx' and modified line */
622c643
< int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */
> int status = luaL_loadbufferx(L, line, len, "=stdin", "t"); /* try it */
696c717,723
< #define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0)
> #if defined(LUA_NODEBUGLIB)
> /* With this option, code must require the debug library before using it */
> #define luai_openlibs(L) luaL_openselectedlibs(L, ~LUA_DBLIBK, LUA_DBLIBK)
> #else
> /* The default is to open all standard libraries */
> #define luai_openlibs(L) luaL_openselectedlibs(L, ~0, 0)
> #endif
717a745
> l_getenv = &no_getenv; /* program will ignore environment variables */
720a749,750
> else
> l_getenv = &getenv;
725,728c755,756
< if (!(args & has_E)) { /* no option '-E'? */
< if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */
< return 0; /* error running LUA_INIT */
< }
> if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */
> return 0; /* error running LUA_INIT */
src/lua.h
16c16
< #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2025 Lua.org, PUC-Rio"
> #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2026 Lua.org, PUC-Rio"
22c22
< #define LUA_VERSION_RELEASE_N 0
> #define LUA_VERSION_RELEASE_N 1
524c524
< * Copyright (C) 1994-2025 Lua.org, PUC-Rio.
> * Copyright (C) 1994-2026 Lua.org, PUC-Rio.
src/luaconf.h
72a73
> #if !defined(LUA_READLINELIB)
74a76
> #endif
80c82
< #define LUA_READLINELIB "libedit.dylib"
> #define LUA_USE_READLINE /* needs an extra library: -lreadline */
227,229c229,231
< LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
< LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
< LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
> LUA_LDIR "?.lua;" LUA_LDIR "?\\init.lua;" \
> LUA_CDIR "?.lua;" LUA_CDIR "?\\init.lua;" \
> LUA_SHRDIR "?.lua;" LUA_SHRDIR "?\\init.lua;" \
235,237c237,239
< LUA_CDIR"?.dll;" \
< LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
< LUA_CDIR"loadall.dll;" ".\\?.dll"
> LUA_CDIR "?.dll;" \
> LUA_CDIR "..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
> LUA_CDIR "loadall.dll;" ".\\?.dll"
248,249c250,251
< LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
< LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
> LUA_LDIR "?.lua;" LUA_LDIR "?/init.lua;" \
> LUA_CDIR "?.lua;" LUA_CDIR "?/init.lua;" \
255c257
< LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
> LUA_CDIR "?.so;" LUA_CDIR "loadall.so;" "./?.so"
342c344,346
< #define LUA_COMPAT_GLOBAL
> #if !defined(LUA_COMPAT_GLOBAL)
> #define LUA_COMPAT_GLOBAL 1
> #endif
652c656
< #if defined(__GNUC__) && !defined(LUA_NOBUILTIN)
> #if !defined(LUA_NOBUILTIN) && defined(__GNUC__) && (__GNUC__ >= 3)
724,725c728,730
< @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure
< ** maximum alignment for the other items in that union.
> @@ LUAI_MAXALIGN defines fields that ensure proper alignment for
> ** memory areas offered by Lua (e.g., userdata memory).
> ** Add fields to it if you need alignment for non-ISO objects.
726a732,736
> #if defined(LLONG_MAX)
> /* use ISO C99 stuff */
> #define LUAI_MAXALIGN long double u; void *s; long long l
> #else
> /* use only C89 stuff */
727a738
> #endif
src/lundump.c
395c395,396
< LClosure *luaU_undump (lua_State *L, ZIO *Z, const char *name, int fixed) {
> LClosure *luaU_undump (lua_State *L, ZIO *Z, Table *anchor, const char *name,
> int fixed) {
408,411c409
< cl = luaF_newLclosure(L, loadByte(&S));
< setclLvalue2s(L, L->top.p, cl);
< luaD_inctop(L);
< S.h = luaH_new(L); /* create list of saved strings */
> S.h = anchor;
413,414c411,412
< sethvalue2s(L, L->top.p, S.h); /* anchor it */
< luaD_inctop(L);
> cl = luaF_newLclosure(L, loadByte(&S));
> luaD_anchorobj(L, anchor, obj2gco(cl));
421d418
< L->top.p--; /* pop table */
src/lundump.h
33,34c33,34
< LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name,
< int fixed);
> LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Table *anchor,
> const char* name, int fixed);
src/lutf8lib.c
58a59,60
> else if (c >= 0xfe) /* c >= 1111 1110b ? */
> return NULL; /* would need six or more continuation bytes */
66a69
> lua_assert(count <= 5);
68c71
< if (count > 5 || res > MAXUTF || res < limits[count])
> if (res > MAXUTF || res < limits[count])
149c152
< lua_pushfstring(L, "%U", (long)code);
> lua_pushfstring(L, "%U", cast(unsigned long, code));
src/lvm.c
271c271
< ** written online with opcode OP_FORLOOP, for performance.)
> ** written inline with opcode OP_FORLOOP, for performance.)
273c273
< static int floatforloop (StkId ra) {
> static int floatforloop (lua_State *L, StkId ra) {
306c306
< setnilvalue(s2v(val)); /* result is nil */
> setnilvalue2s(val); /* result is nil */
363,367c363,373
< t = tm; /* else repeat assignment over 'tm' */
< luaV_fastset(t, key, val, hres, luaH_pset);
< if (hres == HOK) {
< luaV_finishfastset(L, t, val);
< return; /* done */
> t = tm; /* else must repeat assignment over 'tm' */
> /* do the equivalent to 'luaV_fastset', but saving 'h' */
> if (!ttistable(t))
> hres = HNOTATABLE;
> else {
> Table *h = hvalue(t); /* next call can change the value at 't' */
> hres = luaH_pset(h, key, val);
> if (hres == HOK) {
> luaC_barrierback(L, obj2gco(h), val); /* luaV_finishfastset */
> return; /* done */
> }
369c375
< /* else 'return luaV_finishset(L, t, key, val, slot)' (loop) */
> /* else 'return luaV_finishset(L, t, key, val, hres)' (loop) */
922c928
< ** iterpreter loop (function luaV_execute) and may access directly
> ** interpreter loop (function luaV_execute) and may access directly
1844c1850
< else if (floatforloop(ra)) /* float loop */
> else if (floatforloop(L, ra)) /* float loop */