[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to create a C func that returns a lua table
- From: Shannon Stewman <stew@...>
- Date: Thu, 18 Aug 2005 17:58:02 -0500
On Thu, Aug 18, 2005 at 03:28:03PM +0200, Anders Eriksson wrote:
> local tpos = GetPosTable()
> print(tpos) -- says it's a table :)
Then you seem to have successfully defined and returned a Lua table.
> print(tpos[1]) -- says nil :(
The Lua table has no entry tpos[1], which is consistent with how you
defined the table. If you look at tpos['xx'] or another key you
defined, you should see a value.
try:
for k,v in pairs(tpos) do
print( tostring(k) .. " , " .. tostring(v) .. "\n"
end
to see what's actually in the table.
Cheers!
--
Shannon Stewman | Let us walk through the waning night,
Caught in a whirlpool, | As dawn-rays tickle our toes, the dew soothes
A quartering act: | Our blistered soles, and damp bones stir
Solitude or society? | As crimson cracks under the blue-grey sky.