lua-users home
lua-l archive

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

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.


  for k,v in pairs(tpos) do
    print( tostring(k) .. " , " .. tostring(v) .. "\n"

to see what's actually in the table.


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.