Joined common code in 'lua_rawset' and 'lua_rawsetp'

This commit is contained in:
Roberto Ierusalimschy
2019-12-17 15:45:13 -03:00
parent e0ab13c62f
commit c646e57fd6
3 changed files with 25 additions and 23 deletions

View File

@@ -516,9 +516,11 @@ print"+"
do -- getp/setp
local a = {}
T.testC("rawsetp 2 1", a, 20)
local a1 = T.testC("rawsetp 2 1; return 1", a, 20)
assert(a == a1)
assert(a[T.pushuserdata(1)] == 20)
assert(T.testC("rawgetp -1 1; return 1", a) == 20)
local a1, res = T.testC("rawgetp -1 1; return 2", a)
assert(a == a1 and res == 20)
end