lua-users home
lua-l archive

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

Thanks Steve. I should've mentioned that I'd tried to code in debugger (within Zerobrane Lua IDE), stepping through it, with "watch" enabled for rs232, e, p variables, and it was indeed the that failed with e=2, p=nil.

Understood the point about using assert()'s, but doing that alone gave me no more clue than what I already had, thanks to the debugger. Or, am I missing anything here ?

On Sat, Sep 14, 2013 at 4:21 AM, Steve Litt <> wrote:
On Sat, 14 Sep 2013 02:57:11 +0530
Jayanth Acharya <> wrote:

> Presently I am using the library/module "luars232" installed via
> luarocks. I am using this on a Debian Linux machine, on the
> USB-serial port "/dev/ttyUSB0".
> I can access this port perfectly well using tools like picocom or
> minicom, i.e. have proper bi-directional communication.
> However, when I try this snippet:
> [code]
> rs232 = require("luars232")

assert(rs232, "ERROR: nil rs232")

> port_name = "/dev/ttyUSB0"

assert(port_name, "ERROR: nil port_name") --probably needless, but...

> local e, p =

assert(e, "ERROR: nil e")
assert(p, "ERROR: nil p")

> print(e, p)
> [/code]

By doing this, you get a feel for exactly when things start going
south, and you can zero in on the problem.


Steve Litt                *
Troubleshooting Training  *  Human Performance