[ create a new paste ] login | about

Link: http://codepad.org/wGpAa1ph    [ raw code | output | fork ]

Lua, pasted on Oct 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function test(table)
	local orig
	for token in string.gmatch(table, '([^.]+)') do
		if orig == nil then
			orig = token
		else 
			orig = orig.."."..token
		end
		if not _G[token] or not _G[orig] then
			print(orig)
			_G[orig] = {}
			print(_G[orig])
		end
	end
end

test("ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE.VERSION")
print(ADVANCED_INTERFACE_GLOBAL_CONSTANTS)
print(ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS)
print(ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE)
print(ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE.VERSION)


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
line 20: attempt to index field 'STAMPS' (a nil value)
stack traceback:
	t.lua:20: in main chunk
	[C]: ?
ADVANCED_INTERFACE_GLOBAL_CONSTANTS
table: 0x89505d8
ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS
table: 0x894fe90
ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE
table: 0x894ff70
ADVANCED_INTERFACE_GLOBAL_CONSTANTS.STAMPS.ADVANCED_USER_INTERFACE.VERSION
table: 0x8950d68
table: 0x89505d8
nil


Create a new paste based on this one


Comments: