summaryrefslogtreecommitdiffstats
path: root/scope.lua
blob: eecd804d54d65e800972985d297062236cf8cdca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- scope --

do
    -- variable y not in global scope anymore --
    local y = 21
end

function foo()
    -- on the first foo call, the x below will be defined globally --
    -- oy oy oy ooooooy --
    x = 13;

    -- y is not seen here --
    print(y)
end

print(x) -- no x defined --
foo()
print(x) -- x defined after call to foo --