lua-users home
lua-l archive

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


Hi Graham,

That all sounds pretty interesting. I'll be interested to read about it.

A few questions for clarification...

On 27/03/2013 10:20 PM, Graham Wakefield wrote:
Hi Ross,

Nothing terribly documented yet (a journal submission in review...).
Here's the basic idea:

The query system assumes a world of agents which can be arbitrarily
'tagged' with different names, using agent:tag(name) and
agent:untag(name) methods, or Tag[name]:add(agent) to do it the other
way around.

OK.

Tags can be modified directly by assignment, e.g.

Tag.foo = { color = { 1, 1, 0 }, -- etc. }

What is the Tag variable in this example? How does this related to tag/untag example above? is foo the tag, or Tag? or is Tag a collection and .foo a tagged agent previously added with foo:tag("color")?



Queries can work on tagged entities using Q(), which can be chained,
and used to set properties, call methods, etc.:

-- set the amplitude of the most recently created red-tagged agent:
Q("red"):last().amp = 0.5

-- terminate all agents which have a color assigned:
Q("*"):has("color"):die()

-- set the frequency of about half of all agents:
Q("*"):pick(0.5).freq = 200

-- set the frequency of four randomly selected red agents:
Q("red"):pick(4).freq = 500

-- stop one randomly selected agent from moving:
Q("*"):pick():halt()

The expression-object stuff borrows the same syntax as the audio
synth defs in LuaAV.

Nice. Yes I see how this is very similar to jQuery.


-- construct an expression: expr1 = (Max(Random(10), Random(10)) + 2)
* 100

-- assign to property "freq" of all agents tagged "foo" Q("foo").freq
= expr1

This evaluates the expression for each match in the query (so they
all get different random values). Regular Lua functions can be used
too. Stateful expressions (oscillators etc.) create behaviors in the
agent, rather than directly assigning a value.

How do you distinguish between stateful and non-stateful expressions? Is that an attribute that expression objects have?

The distinction between function/expression evaluating and "lifting" a function into a behavior seems an important distinction.


We also added coroutine-based scheduling, and arbitrary event
handling (e.g. agent:on(eventname, callback)).

The infrastructure of tags, queries, exprs, schedulers and events
makes it easy to build up complex structures (and more importantly,
modify them while they run) with very minimal blocks of code. We used
it for collaborative performances creating immersive worlds.

Sounds great.


I hope to get this shaped up into release-worthy condition soon, but
I've just had my first child so time is hard to acquire...

Congratulations on that.

Ross.


Graham

On Mar 27, 2013, at 3:52 PM, Ross Bencina wrote:

On 26/03/2013 9:42 PM, Graham Wakefield wrote:
Our most recent live coding experiments have shifted to using
more declarative problem-oriented syntaxes built on top of Lua,
such as expression object constructions and jQuery-style
select/map applications.

Hi Graham,

Do you have any links to your work with expression objects and
jQuery-style select/map?

I've started to play with Rx-style pipeline constructors for this
kind of thing but no results of note yet.

Ross.