lua-users home
lua-l archive

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

> untested code:
> function GetElement(table, field)
> 	local pos = strfind(field,".")
> 	if pos then 
> 		return GetElement(table[strsub(field,1,pos-1)],
> 	end
> 	return table[field]
> end

That's a step in the right direction. I guess for an arbitrary field
string, which may have any number of periods, you just iteratively get
the next table, get the appropriate field, rinse, and repeat.