Skip to content

Instantly share code, notes, and snippets.

@DamonHao
Created December 22, 2014 02:59
Show Gist options
  • Select an option

  • Save DamonHao/cfbf4c47e4077b0adb95 to your computer and use it in GitHub Desktop.

Select an option

Save DamonHao/cfbf4c47e4077b0adb95 to your computer and use it in GitHub Desktop.
Local and global variable
function test()
x = 1 -- default is global
local y = 2
end
local function main()
test()
print(x, y)
end
main()
-- output 1 nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment