Created
August 5, 2016 00:19
-
-
Save katlogic/9c02921f531f49c2b03a4610d891ff11 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- compat | |
| local unpack = table.unpack or unpack | |
| local print = print | |
| local debug = debug | |
| local table = table | |
| local _ENV = setmetatable({}, {__index=function(t,k) | |
| if (k ~= 'arg') then | |
| error("undefined global "..k) | |
| end | |
| local res = {} | |
| local i = -1 | |
| while true do | |
| local n, v = debug.getlocal(2, i) | |
| i = i - 1 | |
| if not n then return res end | |
| table.insert(res, v) | |
| end | |
| end}) | |
| -- 5.1 code follows | |
| function x(...) | |
| print(unpack(arg)) | |
| end | |
| x(1,2,3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment