lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello everyone,
Do you know how to call Lua functions recursively.
Such as I have a Lua function


function gettable(t)
	local numEntries, e, name, flag, value
	numEntries = GetNumEntriesForTable(t)
	print("number of entries is ", numEntries)
	for i=1, numEntries do
		e = GetTableEntryByIndex(b, i)
		name = GetEntryName(e) 
		flag = GetEntryFlag(e)
		value = GetEntryValue(e)
		print("name is ", name)
		print("flag is ", flag)
		print("value is ", value)
		if (flag == 32)
		then
			gettable(value)
		end		
	end
end

But I failed to recursively call gettable in gettable.
Anyone can tell me how to call lua functions recursively ?

Honglei