lua-users home
lua-l archive

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



Hi


I am tinkering around with adding some basic Windows Forms functionality from Lua into My C# App. I am using LuaInterface as the glue.


I decided to firstly ignore the Lua syntax and just try and get something working and then re look at the Lua syntax later. I am at that point now but not too sure how to proceed.


I have got code like this to create a Windows Form


local frm1 = myApp.newForm ({})    -- The passed in table contains form init params, omitted for brevity


in the c# code the function newForm() just simply return the c# Windows Form instance, which then gets returned to Lua as a Userdata (LuaInterface handles that conversion)


I can then call a method of the form in Lua by this code


  myApp.method(frm1 , "Show")


this all works fine and in the C# code it calls frm1Show() to display the form.


The obvious thing I dont like about that is the horrible syntax, I want to be able to call something like frm1.show() in Lua.

How would I go about rejigging that syntax construct ?  Any tips would be greatly appreciated, thanks


Geoff