lua-users home
lua-l archive

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

On Sun, 3 May 2009 22:15:04 -0700 (PDT)
Dave Smead <> wrote:

> At the moment I'm still having some difficulties getting Lua packages
> installed because I'm not up to speed on luarocks yet.  I'm a little
> hesitant to download packages outside the luarocks mechanism because I'm
> painfully aware that grabbing a tar.gz file and running make will
> sometimes clobber library versions that are used by programs obtained
> via apt-get, (that is make a mess that is difficult to clean up).
> My immediate interest is using Lua to access graphics primitives such as
> draw-line, draw-circle, draw-arc, etc.  I see there are bindings to SDL,
> opengl, wx, tk and others.  While I need some gui widgets, mostly I need
> widgets that represent analog meters, and trend graphs, (plots). I have
> C code from the 1980's that ran on DOS with a primitive vgalib so
> primitive is fine for what I need.
> Can anyone offer opinions of which graphics library would be best
> suited?

I don't know which package is best suited, but recently we have added a
graph class to tekUI [1] that might serve as an example for custom
visualizations. Widgets and some graphics primitives are provided, but
arc/circle functions are missing and would have to be emulated. Your
hesitance to install the package should be no issue, because you can
run the examples locally, without installing anything.

The installation docs [2] list the Ubuntu packages required to build
the project. After installing them, the following commands should be
sufficient to get the example on your screen:

# wget
# tar xzf tekui-snapshot.tar.gz
# cd tekui-snapshot
# make all
# bin/meter.lua

See also the screenshots section to get an impression.

> The graphics rendering program will run on a Linux machine, but I want
> to connect it via a TCP socket to a very small microcomputer that tells
> the rendering program what to draw using ASCII strings, or better yet,
> by passing a Lua table to the rendering program.

Messages from the outside coming in via stdin are dispatched to the
toolkit and can be intercepted in custom classes, so all you had to do
would be to forward them from the network to your program. The
meter.lua example demonstrates how to register a handler that parses
them and causes a redraw:

 self.Application:addInputHandler(ui.MSG_USER, self, self.updateData)

- Timm


Timm S. Mueller <>
Schulze & Mueller GbR, Erbacher Straße 26, 64342 Seeheim-Jugenheim,
Gesellschafter: Franciska Schulze, Timm S. Mueller,
Tel. +49 6257 648853-0,