[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LUA userdata
- From: Sam Roberts <sroberts@...>
- Date: Wed, 21 Feb 2007 09:14:24 -0800
On Wed, Feb 21, 2007 at 05:49:29PM +0100, Verriere Joseph wrote:
> No, it isn't specific to wireshark. I only needed this:
>
> function extract_com.packet()
>
> local values = { ctxId() }
> -- {} is a table constructor, so values is a table
>
> -- then you can iterate over the entries in your "values" table
> for i,value in ipairs(values) do
>
> print (i, value)
>
> test = tostring(value)
> print (test)
> end
>
> -- You can even return all values if you want using unpack:
> return unpack(values)
> end
Sorry, I thought the two posts were two different questions - the above
doesn't have any obvious connection to userdata:
function ctxId()
return "a", "b", "c"
end
function packet()
local values = { ctxId() }
for i,value in ipairs(values) do
print(i, value)
end
return unpack(values)
end
packet()
# =>
1 a
2 b
3 c
Cheers,
Sam