mirror of
https://github.com/lua/lua
synced 2026-09-27 00:28:25 +03:00
Global initialization checks name conflict
Initialization "global a = 10" raises an error if global 'a' is already defined, that is, it has a non-nil value.
This commit is contained in:
parent
f791bb6906
commit
e44f3a2ffc
13 changed files with 87 additions and 9 deletions
|
|
@ -166,9 +166,9 @@ local function expand (n,s)
|
|||
e, s, expand(n-1,s), e)
|
||||
end
|
||||
|
||||
G=0; collectgarbage(); a =collectgarbage("count")
|
||||
G=0; collectgarbage()
|
||||
load(expand(20,"G=G+1"))()
|
||||
assert(G==20); collectgarbage(); -- assert(gcinfo() <= a+1)
|
||||
assert(G==20); collectgarbage()
|
||||
G = nil
|
||||
|
||||
testamem("running code on new thread", function ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue