[PD] Fun with Lua coroutines

Frank Barknecht fbar at footils.org
Wed Oct 31 21:11:26 CET 2007

Luigi Rensinghoff hat gesagt: // Luigi Rensinghoff wrote:

> What could pdlua be good for ? 

Well, scripting can be used to easily overcome some limitations of Pd.
pdlua or whatever scripting language could be used to replace a lot of
externals. One Lua fits all. When used to replace abstractions, it may
even be faster. (I'm considering to implement list-abs alternatively
as Lua classes, it would become much, much faster.)

> Or better asked - and i would  
> appreciate an answer for non-nerds - what reason could there be for  
> using another extension language within pd ?? 

Are you using *any* extension language in Pd? 

If not, lua may be the easiest start: It's easy to compile, compiled
versions could be statically compiled, the language is fully documented
with a wonderful book (see www.lua.org).

> What is the difference to for examples python, or writing a specifi  
> external ???

Lua and Python are quite similar, and I like them both. Lua is faster
than Python (and of course faster than Tcl, too), but Lua lacks the
huge amount of libraries that come with Python. 

One nice thing about Lua is, that it's written in just ANSI-C. It
could even be included in Miller's Pd as a general scripting language
without any dependencies. (Though pdlua's choice of GPL does not quite
fit the BSD/MIT tradition of Pd and Lua.) Pd immediatly would get an
important data type that is currently missing: hash/dictionary/table.
Lua could also be used as a very powerful "textfile" replacement, that
would allow more structured score files in a BibTex fashion. Wait for
an example for this coming soon.  Pd-extended could include pdlua as a
static build without adding a single dependency.(The Lua library
really is tiny - about 200k, I even run Lua apps on my Nintendo DS.)

Lua and Pd seem to share a similar mindset in some parts. For example
both come with a complete, but rather small set of core features to
limit the number of dependencies. Additional features are developed
outside of the core.

Language freaks (nerds) can find some nice features as well. The
coroutines feature that started this thread is an example, closures
and recursion are others.

Well, but above all it's fun to write Lua programs. Why, that's hard
to explain.

 Frank Barknecht                                     _ ______footils.org__

More information about the Pd-list mailing list