lua-users home
lua-l archive

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


> Do you have a different variable 'interface' defined somewhere else? What is
> the error you are seeing?
> 
> Because I'd have thought this would work:
> 
> C:\>lua
> Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> > T = { v = 1, f = function() print("Here is T.v: " .. T["v"]) end }
> > T.f()
> Here is T.v: 1
> > T = { v = 42, f = function() print("Here is T.v: " .. T.v) end }  -- or
> using dot notation
> > T.f()
> Here is T.v: 42
> >
> 
> Robby
 
Oh, mea culpa! I tried this:
 

xxx = {

    a = 10,

    b = xxx["a"]

}

print(xxx["a"], xxx["b"])

 

As this (presumably simpler) case did not work, I did not even try with a function!

 

Thanks a lot for your help,

 

Christof