[PD] Lua and PD (update)

Mike McGonagle mjmogo at gmail.com
Tue May 6 23:27:28 CEST 2008


Hum, from what I see on this, pdlua uses one method of "object
encapsulation", while pdluax uses this single method type of object.

I know that Lua itself doesn't have an object style, I am just curious
how pdlua does this, so that I can at least follow along in the style
being used.

I really like what I have seen with pdlua, and you are right, Frank, I
also think this will help to open up PD. One of the things that I have
had trouble with in PD (by itself) was having to go in and repatch
things to make some sort of change in how I am generating the data,
while using pdlua, I think that it will make these sorts of changes
much easier to understand.


Mike


On 5/6/08, Frank Barknecht <fbar at footils.org> wrote:
> Hallo,
>
> Mike McGonagle hat gesagt: // Mike McGonagle wrote:
>
>  > On 5/6/08, Claude Heiland-Allen <claudiusmaximus at goto10.org> wrote:
>
> > >  The object system in pdlua isn't particularly well-thought out or elegant,
>  > > I'd be interested in what you had developed and how it differs - maybe I
>  > > could learn something from it.
>  >
>  > Well, thanks for that vote of encouragement, but after studying the
>  > methods used in pdlua, it is actually a bit less verbose. Many of the
>  > things I had done my way were about a 1/3 longer. It was a method that
>  > I borrowed from a book I have.
>
>
> Actually Lua itself doesn't have a preconfigured object system like
>  C++ or Python, so you'd have to roll your own anyway. Pdlua uses a
>  protype-based objects system.
>
>  Another interesting "object system" would be the Single Method
>  approach: http://www.lua.org/pil/16.5.html where you use a closure to
>  store the object's state.
>
>  I recently wrote a LOGO-style turtle using this idiom. Attached is a
>  simplified version of it (removed typechecks etc).
>
>  Take special note of how seamlessly the single method turtle in
>  smtut.lua can be included in the Pd object runturtle.lua using this
>  primitive method:
>
>     function M:in_1(action, atoms)
>         self.t(action, atoms) -- selt.t is the single method turtle
>     end
>
>  It's even possible to convert smtut.lua to a proper module so that you
>  can reload it luax-style while Pd is running.
>
>  Ciao
>
> --
>   Frank Barknecht                                     _ ______footils.org__
>
> _______________________________________________
>  PD-list at iem.at mailing list
>  UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
>
>


-- 
Peace may sound simple—one beautiful word— but it requires everything
we have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician




More information about the Pd-list mailing list