mirror of
https://github.com/lua/lua.git
synced 2026-06-08 08:03:49 +00:00
New conceptual model for vararg
Conceptually, all functions get their vararg arguments in a vararg table. The storing of vararg arguments in the stack is always treated as an optimization.
This commit is contained in:
@@ -702,7 +702,9 @@ else
|
||||
assert(t.currentline == t.linedefined + 2)
|
||||
assert(not debug.getinfo(c, 1)) -- no other level
|
||||
assert(coroutine.resume(c)) -- run next line
|
||||
local n,v = debug.getlocal(c, 0, 2) -- check next local
|
||||
local n,v = debug.getlocal(c, 0, 2) -- check vararg table
|
||||
assert(n == "(vararg table)" and v == nil)
|
||||
local n,v = debug.getlocal(c, 0, 3) -- check next local
|
||||
assert(n == "b" and v == 10)
|
||||
v = {coroutine.resume(c)} -- finish coroutine
|
||||
assert(v[1] == true and v[2] == 2 and v[3] == 3 and v[4] == undef)
|
||||
|
||||
Reference in New Issue
Block a user