lua-users home
lua-l archive

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


Hello All,

We have Lua table definition like this.

DeviceTag = VARIABLE
{
    name = "DeviceTag",
    data_type = Float,
    address = 100
}

We have written data access layer which shall be used like this.

DeviceDataSource.Read(DeviceTag);

the function Read is written in C++(COM)/C#. It reads the value from device and set the value to DeviceTag

DeviceTag.value = <<Data read from device>>

We will be using the DeviceTag.value for arithmetic operations, comparisons.

Now the question is, how do I access the value attribute without mentioning it.

like this

if (DeviceTag == "Krish") then

  do something here

end

Whereas when I say DeviceTag during comparison, it should provide me the DeviceTag.value by default.

Something like operator overload is possible to get this? Our attempt is, there a Device Description Language available and we want to generate our Lua code from existing Device Description Language.
I know Lua is general purpose and DSL defined must confirm Lua syntax. I am curious to learn Lua and creating DSL for our company.

Regards,

Gopalakrishnan