Newbie rttlua question: How to set a Property value?

Dear all,

When I try to set a property of one of the components:

...
deployer:loadComponent("soemMaster","soem_master::SoemMasterComponent")
soemMaster=deployer:getPeer("soemMaster")
soemMaster.ifname = "eth1"

I get (from the last line):

stdin:1: attempt to index global 'soemMaster' (a userdata value)
stack traceback:
stdin:1: in main chunk
[C]: ?

Anyone know the correct syntax for setting a Property in rttlua?

I already tried looked for getter and setter functions for properties
in soemMaster, and there don't seem to be any.

Thanks!
Andrew

Newbie rttlua question: How to set a Property value?

Hi Andrew,
try with the following code:

soemMaster:getProperty("ifname")
ifname:set("eth1")

I suggest you to have a look at this page
http://www.orocos.org/wiki/orocos/toolchain/luacookbook , it's really well
done and explained.

Have a nice day,
Nicola

2013/7/8 Andrew Wagner <andrew [dot] wagner [..] ...>

> Dear all,
>
> When I try to set a property of one of the components:
>
> ...
> deployer:loadComponent("soemMaster","soem_master::SoemMasterComponent")
> soemMaster=deployer:getPeer("soemMaster")
> soemMaster.ifname = "eth1"
>
> I get (from the last line):
>
> stdin:1: attempt to index global 'soemMaster' (a userdata value)
> stack traceback:
> stdin:1: in main chunk
> [C]: ?
>
> Anyone know the correct syntax for setting a Property in rttlua?
>
> I already tried looked for getter and setter functions for properties
> in soemMaster, and there don't seem to be any.
>
> Thanks!
> Andrew
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Newbie rttlua question: How to set a Property value?

Thanks Nicola!

ifname = soemMaster:getProperty("ifname")
ifname:set("eth1")

worked. A one-liner version works too:

soemMaster:getProperty("ifname"):set("eth1")

Cheers,
Andrew

On Mon, Jul 8, 2013 at 7:16 PM, Nicola Preda <nicola [dot] preda [..] ...> wrote:
> Hi Andrew,
> try with the following code:
>
> soemMaster:getProperty("ifname")
> ifname:set("eth1")
>
> I suggest you to have a look at this page
> http://www.orocos.org/wiki/orocos/toolchain/luacookbook , it's really well
> done and explained.
>
> Have a nice day,
> Nicola
>
> 2013/7/8 Andrew Wagner <andrew [dot] wagner [..] ...>
>>
>> Dear all,
>>
>> When I try to set a property of one of the components:
>>
>> ...
>> deployer:loadComponent("soemMaster","soem_master::SoemMasterComponent")
>> soemMaster=deployer:getPeer("soemMaster")
>> soemMaster.ifname = "eth1"
>>
>> I get (from the last line):
>>
>> stdin:1: attempt to index global 'soemMaster' (a userdata value)
>> stack traceback:
>> stdin:1: in main chunk
>> [C]: ?
>>
>> Anyone know the correct syntax for setting a Property in rttlua?
>>
>> I already tried looked for getter and setter functions for properties
>> in soemMaster, and there don't seem to be any.
>>
>> Thanks!
>> Andrew
>> --
>> Orocos-Users mailing list
>> Orocos-Users [..] ...
>> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>
>
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Newbie rttlua question: How to set a Property value?

2013/7/8 Andrew Wagner <andrew [dot] wagner [..] ...>

> Thanks Nicola!
>
> ifname = soemMaster:getProperty("ifname")
> ifname:set("eth1")
>

You are welcome! (Sorry, I forgot to assign the result of getProperty ;) )

Bye,
Nicola

>
> worked. A one-liner version works too:
>
> soemMaster:getProperty("ifname"):set("eth1")
>
> Cheers,
> Andrew
>
> On Mon, Jul 8, 2013 at 7:16 PM, Nicola Preda <nicola [dot] preda [..] ...>
> wrote:
> > Hi Andrew,
> > try with the following code:
> >
> > soemMaster:getProperty("ifname")
> > ifname:set("eth1")
> >
> > I suggest you to have a look at this page
> > http://www.orocos.org/wiki/orocos/toolchain/luacookbook , it's really
> well
> > done and explained.
> >
> > Have a nice day,
> > Nicola
> >
> > 2013/7/8 Andrew Wagner <andrew [dot] wagner [..] ...>
> >>
> >> Dear all,
> >>
> >> When I try to set a property of one of the components:
> >>
> >> ...
> >> deployer:loadComponent("soemMaster","soem_master::SoemMasterComponent")
> >> soemMaster=deployer:getPeer("soemMaster")
> >> soemMaster.ifname = "eth1"
> >>
> >> I get (from the last line):
> >>
> >> stdin:1: attempt to index global 'soemMaster' (a userdata value)
> >> stack traceback:
> >> stdin:1: in main chunk
> >> [C]: ?
> >>
> >> Anyone know the correct syntax for setting a Property in rttlua?
> >>
> >> I already tried looked for getter and setter functions for properties
> >> in soemMaster, and there don't seem to be any.
> >>
> >> Thanks!
> >> Andrew
> >> --
> >> Orocos-Users mailing list
> >> Orocos-Users [..] ...
> >> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
> >
> >
> >
> > --
> > Orocos-Users mailing list
> > Orocos-Users [..] ...
> > http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
> >
>