diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-26 14:59:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-26 14:59:39 -0300 |
commit | b80077b8f3e27a94c6afa895b41a9f8b52c42e61 (patch) | |
tree | 8a7c21ee0acfed553ef1d92bdfd7b1f728f35a91 /testes/strings.lua | |
parent | e70f275f32a5339a86be6f8b9d08c20cb874b205 (diff) | |
download | lua-b80077b8f3e27a94c6afa895b41a9f8b52c42e61.tar.gz lua-b80077b8f3e27a94c6afa895b41a9f8b52c42e61.tar.bz2 lua-b80077b8f3e27a94c6afa895b41a9f8b52c42e61.zip |
Change in the handling of 'L->top' when calling metamethods
Instead of updating 'L->top' in every place that may call a
metamethod, the metamethod functions themselves (luaT_trybinTM and
luaT_callorderTM) correct the top. (When calling metamethods from
the C API, however, the callers must preserve 'L->top'.)
Diffstat (limited to '')
-rw-r--r-- | testes/strings.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/testes/strings.lua b/testes/strings.lua index 0e7874bf..aa039c4f 100644 --- a/testes/strings.lua +++ b/testes/strings.lua | |||
@@ -167,8 +167,11 @@ do -- tests for '%p' format | |||
167 | local t1 = {}; local t2 = {} | 167 | local t1 = {}; local t2 = {} |
168 | assert(string.format("%p", t1) ~= string.format("%p", t2)) | 168 | assert(string.format("%p", t1) ~= string.format("%p", t2)) |
169 | end | 169 | end |
170 | assert(string.format("%p", string.rep("a", 10)) == | 170 | do -- short strings |
171 | string.format("%p", string.rep("a", 10))) -- short strings | 171 | local s1 = string.rep("a", 10) |
172 | local s2 = string.rep("a", 10) | ||
173 | assert(string.format("%p", s1) == string.format("%p", s2)) | ||
174 | end | ||
172 | do -- long strings | 175 | do -- long strings |
173 | local s1 = string.rep("a", 300); local s2 = string.rep("a", 300) | 176 | local s1 = string.rep("a", 300); local s2 = string.rep("a", 300) |
174 | assert(string.format("%p", s1) ~= string.format("%p", s2)) | 177 | assert(string.format("%p", s1) ~= string.format("%p", s2)) |