Starting with LUA

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Starting with LUA

pablo

Hello all,

 

I’m starting with LUA.   I started with Lua for Windows v5.1.5-52 Released  https://github.com/rjpcomputing/luaforwindows/releases     I can do simple thing like:

 

Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

> a=10

> b=20

> =a+b

30

> io.write("Hello world, from ",_VERSION,"!\n")

Hello world, from Lua 5.1!

> 

 

Our idea is implemt LUA in a WinCE 6 device, What do you think, is it posible?

We have a main program running, monitoring serial port if something happen it is shown in a Web, and from Web we can send something to the serial port. Our goal is provide more inteligence to our device.

For example, if something happen in the serial port, execute a logic AND, Is it posible to trigger LUA with a variable from my main program? How can the output of LUA inform the main program with the result?  

 

 

Thanks in advance,

Pablo

 

 

 

 

v
Reply | Threaded
Open this post in threaded view
|

Re: Starting with Lua

v
> I’m starting with LUA.   I started with Lua for Windows v5.1.5-52
> Released  https://github.com/rjpcomputing/luaforwindows/releases
It's called Lua, not LUA. Also, is there any reason to choose such old
version when 5.4 is out? 5.4 is still a bit experimental, so 5.3 might
be your best bet for now.

> Our idea is implemt LUA in a WinCE 6 device, What do you think, is it
> posible?

Lua is written in ANSI C, so it should be possible to run it there.
> We have a main program running, monitoring serial port if something
> happen it is shown in a Web, and from Web we can send something to
> the serial port. Our goal is provide more inteligence to our device.
>
> For example, if something happen in the serial port, execute a logic
> AND, Is it posible to trigger LUA with a variable from my main
> program? How can the output of LUA inform the main program with the
> result?  

I don't exactly understand what is your plan here. While I'm not
familiar with WinCE at all, you have two options:

1) Run standard Lua interpreter as a separate process. In this case,
you should look up how interprocess communication is done in WinCE. I
expect standard things like stdio and passing arguments to command to
work.
2) Run Lua directly inside main program, linked to it either statically
(recommended for your use case) or dynamically. In this case, all
interaction with Lua is done using its C API, which is described in
details in Lua's reference manual.
--
v <[hidden email]>