[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Overloaded conditional operators in Lua
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 11 Nov 2010 08:05:10 -0200
> DeviceTag = VARIABLE
> {
> name = "DeviceTag",
> data_type = Float,
> address = 100
> }
>
> if (DeviceTag == "Krish") then
I see a couple of ways:
1. Set a __call metamethod and write
if (DeviceTag() == "Krish") then
2. If all your VARIABLEs are global, then you can set a __newindex
metamethod in _G to save VARIABLEs elsewhere and set an __index
metamethod to retrieve x.value when x is seen and there is a VARIABLE
named x.
9. Wait for 5.2 and set __eq and write :-)
if (DeviceTag == "Krish") then