lua-users home
lua-l archive

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



Hi


I am wondering if  __index & __newindex metamethods can be used to solve this slightly complex specific problem


I am trying to wire up Lua to a Windows Gui  function. Lets take an example in C#


my C# line inside my binding function is  


    dgv1.Rows[1].Cells[4].Style.BackColor = Color.Yellow;


The binding function is called from Lua as below

    

    gridSetStyle(1, 4, luaStyleTable)


Where arg 1 is rowIndex,  arg 2 is CellIndex and


arg 3 luaStyleTable  is { BackColor = Yellow}


this works but the syntax in Lua isnt nice to require the line gridSetStyle(1, 4, luaStyleTable)


What I am trying to do is get Lua to have a metamethod that triggers and calls that function in the background


My preferred lua syntax mimics the C# line, so I would like to trigger a call to that function with something like


  dgv1.Rows[1].Cells[4].Style.BackColor = "Yellow";


I suspect this probably isnt possible, can anyone prove me wrong ? Or alternatively suggest another variation on how to solve it ?


Thanks Geoff