tests/fail/demo_globals.lua

Tue, 26 Oct 2010 10:43:56 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 26 Oct 2010 10:43:56 +0100
changeset 57
3e148db7f933
permissions
-rw-r--r--

Add tests/ to the repo

-- globals.lua
-- show all global variables

local seen={}

function dump(t,i)
	seen[t]=true
	local s={}
	local n=0
	for k in pairs(t) do
		n=n+1 s[n]=k
	end
	table.sort(s)
	for k,v in ipairs(s) do
		print(i,v)
		v=t[v]
		if type(v)=="table" and not seen[v] then
			dump(v,i.."\t")
		end
	end
end

dump(_G,"")

mercurial