rttlua-gnulinux fails to import components

Hi all,

I payed around with lua and right after starting "rttlua-gnulinux" I get the message:

  0.049 [ ERROR  ][DeploymentComponent::import] Failed to import components, types or plugins   from package or directory 'ocl' found in:
  0.049 [ ERROR  ][DeploymentComponent::import]   ocl:ocl/gnulinux:/opt/orocos/install/lib/orocos/gnulinux/ocl:./ocl
  OROCOS RTTLua 1.0-beta3 / Lua 5.1.4 (gnulinux)
Nevertheless I tried the example from the LuaCookbook... In section 5.3 the cookbook says that "p1=3.14" will not work, but it worked fine for me .. as it looked, but a later call of
  print("the value of " .. p1:info().name .. " is: " .. p1:get())
failed with
  stdin:1: attempt to index global 'p1' (a number value)
  stack traceback:
  stdin:1: in main chunk
  [C]: ?
I created another property and did not call "p2=3.14" and than the call of p2:info() and p2:get() worked. Looks like a nice trap to me, may be the warning should be bigger in cookbook . . .. .

Is there a special reason for the break in syntax? some calls are name.func() and others name:func() ???

Ciao Joerg

rttlua-gnulinux fails to import components

Hi Joerg,

Sorry for the late reply, I missed your email somehow.

On Sat, Jun 18, 2011 at 05:41:21PM +0200, joerg [..] ... wrote:
>
> I payed around with lua and right after starting "rttlua-gnulinux" I get the message:
>
> 0.049 [ ERROR ][DeploymentComponent::import] Failed to import components, types or plugins from package or directory 'ocl' found in:
> 0.049 [ ERROR ][DeploymentComponent::import] ocl:ocl/gnulinux:/opt/orocos/install/lib/orocos/gnulinux/ocl:./ocl
> OROCOS RTTLua 1.0-beta3 / Lua 5.1.4 (gnulinux)
>
> Nevertheless I tried the example from the LuaCookbook...
> In section 5.3 the cookbook says that "p1=3.14" will not work, but it worked fine for me ..
> as it looked, but a later call of
> print("the value of " .. p1:info().name .. " is: " .. p1:get())
> failed with
> stdin:1: attempt to index global 'p1' (a number value)
> stack traceback:
> stdin:1: in main chunk
> [C]: ?
> I created another property and did not call "p2=3.14" and than the call of p2:info() and p2:get() worked.

Lua works with references. Because of that p1=3 will set the variable
p1 to 3 and not assign the property the value 3. Hence it "works", but
not in they way you wanted it to. If you have a complex type (a type
with subfields) it does do the right thing because you are
dereferencing the complex type.

We could hack the syntax to solve this, but this would deviate from
how the Lua language behaves and what people familiar with Lua will
expect.

> Looks like a nice trap to me, may be the warning should be bigger in
> cookbook . . .. .

It's s a wiki, so feel free to make changes!

> Is there a special reason for the break in syntax? some calls are
> name.func() and others name:func() ???

'.' is used for indexing "indexable" things like types and tables.
':' is used to call methods or operations!

Markus