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'.)
This commit is contained in:
@@ -167,8 +167,11 @@ do -- tests for '%p' format
|
||||
local t1 = {}; local t2 = {}
|
||||
assert(string.format("%p", t1) ~= string.format("%p", t2))
|
||||
end
|
||||
assert(string.format("%p", string.rep("a", 10)) ==
|
||||
string.format("%p", string.rep("a", 10))) -- short strings
|
||||
do -- short strings
|
||||
local s1 = string.rep("a", 10)
|
||||
local s2 = string.rep("a", 10)
|
||||
assert(string.format("%p", s1) == string.format("%p", s2))
|
||||
end
|
||||
do -- long strings
|
||||
local s1 = string.rep("a", 300); local s2 = string.rep("a", 300)
|
||||
assert(string.format("%p", s1) ~= string.format("%p", s2))
|
||||
|
||||
Reference in New Issue
Block a user