lua-users home
lua-l archive

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


Suppose I have a table:

Config = {
  Dir = "somestring/",
  File = "somefile"
};

Is there a way to access the value of "Dir" while
initializing "File".

i.e.

Config = {
  Dir = "somedir/";
  File = ["Dir"] .. "somefile"
};

Note this gives a parse error in 3.2 as I think it probably
should (according to the manual).  But, is there any way
to accomplish this?

This problem comes up often in my use of Lua.  Other examples:

Config = {
  Pos = { 0, 1 },
  Window = mainwindow{ Offset = would_like_to_use_pos }
};

Paul