diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-01-11 15:03:01 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-01-11 15:03:01 -0300 |
| commit | cc1692515e2a6aabc6d07159e7926656e38eda53 (patch) | |
| tree | bc89a17cdc55a52897cc0d5a862cbc34314ada93 /ltests.c | |
| parent | ce101dcaf73ff6d610593230d41b63c163a91519 (diff) | |
| download | lua-cc1692515e2a6aabc6d07159e7926656e38eda53.tar.gz lua-cc1692515e2a6aabc6d07159e7926656e38eda53.tar.bz2 lua-cc1692515e2a6aabc6d07159e7926656e38eda53.zip | |
New API function 'lua_closeslot'
Closing a to-be-closed variable with 'lua_settop' is too restrictive,
as it erases all slots above the variable. Moreover, it adds side
effects to 'lua_settop', which should be a fairly basic function.
Diffstat (limited to 'ltests.c')
| -rw-r--r-- | ltests.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -1766,6 +1766,9 @@ static struct X { int x; } x; | |||
| 1766 | else if EQ("toclose") { | 1766 | else if EQ("toclose") { |
| 1767 | lua_toclose(L1, getnum); | 1767 | lua_toclose(L1, getnum); |
| 1768 | } | 1768 | } |
| 1769 | else if EQ("closeslot") { | ||
| 1770 | lua_closeslot(L1, getnum); | ||
| 1771 | } | ||
| 1769 | else luaL_error(L, "unknown instruction %s", buff); | 1772 | else luaL_error(L, "unknown instruction %s", buff); |
| 1770 | } | 1773 | } |
| 1771 | return 0; | 1774 | return 0; |
