Hi, Unfortantly I have little success with this. So I have this function in tag.lua:
--- Return the division tree of the tag function getdivisiontree(t) local t = t or selected() local tree tree = getproperty(t, "division_tree") or {} if #tree==0 then tree={} tree.division="none" tree.ratio=0.5 setproperty(t, "division_tree", tree) end return tree end See Idea is, that when no decision tree exists yet, one is created. But I get an error: tag.lua:304: table index is nil On Tue, Jun 02, 2009 at 11:01:23PM +0200, Gregor Best wrote: > On Tue, Jun 02, 2009 at 10:48:13PM +0200, Nathan Huesken wrote: > > [...] > > - OK, I can set simple properties of a tag and a client using > > "setproperty". But I need something more complex. I need to store a tree > > structure telling me how the area has been divided. > > So I need a "root-node" object, stored in the tag. And this root node > > has 2 of the same kind (until a leave node is reached). > > Can this also be archived with setproperty? I do not see how but I am > > completly new to lua! > > > > [...] > > You can easily store tables inside the tag properties. With some > handling functions, tables can be modelled like trees (bintree, octree, > k-tree, whatever you want), which should be what you want. You'd do > something like this: > > local tree = { } > tree.left = { } > tree.right = { } > tree.content = foobar > tree.left.left = { } > tree.left.right = { } > tree.left.content = gna > awful.tag.setproperty(t, "divisions", tree) > > -- > GCS/IT/M d- s+:- a--- C++ UL+++ US UB++ P+++ L+++ E--- W+ N+ o-- > K- w--- O M-- V PS+ PE- Y+ PGP+++ t+ 5 X+ R tv+ b++ DI+++ D+++ G+ > e- h! r y+ > > Gregor Best -- To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.