Commit Graph

34 Commits

Author SHA1 Message Date
Julien Danjou 7e15509733 screen: implement tags set/get as function
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-13 18:12:26 +02:00
Julien Danjou c2f8275bf8 client: deprecate client_get() and client_set()
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-12 12:17:19 +02:00
Julien Danjou ab66b87377 lua: fix otable __newindex
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-11 23:33:35 +02:00
Julien Danjou 9f503e5a13 lua: rename luaA_function to luaA_ref
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-11 10:12:36 +02:00
Julien Danjou b92a07c2ed Revert "Alternative export method of arrays from C to Lua"
This reverts commit 4ab499fe26.

Conflicts:

	lua.h
2008-08-11 02:21:21 +02:00
Julien Danjou c4999bd59d lua: fix __next, must return 2 values
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 17:23:08 +02:00
Julien Danjou a5806d5e61 lua: arrays use __next and __pairs metamethods
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:19:56 +02:00
Konstantin 4ab499fe26 Alternative export method of arrays from C to Lua
The patch is mainly to export client_array_t object to Lua,
but can be used to export any ..._array_t object.

The idea: export to Lua not a table, but userdata with
metamethods to get/set/define length of ..._array_t object
directly.

Now when I get clients field from tag object C code
creates full copy of client_array_t structure into Lua table.
It takes traversing a whole array of data.

I did it in other way: userdata is exported, with __index,
__newindex, and __len meta-methods defined, and Lua
script gains direct access to client_array_t C-array:
it can get client object, get length of array and assign
client objects to some index in C-array.

Pros:
No overhead of creation a copy of C-structure into Lua-table:
if I want just to test a number of clients for a tag, I don't need
a whole loop to build table, I just want to read clients->len field,
and I do so via __len meta-method.
Also if I want to get some client from tags.clients, I don't need
to create ALL clients Lua-objects, I just get client_t C-struct
and create Lua-object from it. Just in place.
So Lua-loop enuming all tag.clients is not 2 loops internally
(first create copy of tag.clients into Lua-table, then enum this table),
but only one, and if I break out of loop in the middle, I create
only some client Lua-objects, not all of them from tag.clients.

Contras:
As far as clients field is not a table, I cant use pairs/ipairs
and other table functions for it.
But it can be implemented in other way:
for k,c pairs(tag.clients) => for k = 1, #tag.clients,
table.insert(tag.clients, client) => tag.clients[#tag.clients+1] = client

etc.

One more Pro now:
As far as tag.clients in current implementation returns copy of data
table.insert doesn't do what's expected: it doesn't really add client
into tag.clients "array".
With my implementation client is added as expected, as we work with
client_array_t structure directly.

Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:18:59 +02:00
Julien Danjou 8b5f6266da lua: add support for __pairs and __next metamethods
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-10 16:15:15 +02:00
Julien Danjou 81da69b282 lua: remove spurious \n
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-08 14:37:27 +02:00
Julien Danjou 3814103a1e lua: implement objecttable
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-08-07 16:39:30 +02:00
Julien Danjou 18fab522f9 lua: expand package.path more
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-30 18:20:19 +02:00
Julien Danjou 79dc1a9501 lua: dofunction is no more a macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-29 11:03:48 +02:00
Julien Danjou 2a5eba569d lua: pop error
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-10 11:02:11 +02:00
Julien Danjou f364dc07e2 lua: check f against REFNIL
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 14:07:49 +02:00
Julien Danjou 3f46ec2152 tasklist: use a callback for label
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-09 12:12:52 +02:00
Julien Danjou fb13bff697 config: use XDG for loading config
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-08 14:07:56 +02:00
Pierre Habouzit 46ea7c45aa Get rid of the color name, and generate a #RGBA value on the fly if needed.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-02 11:09:10 +02:00
Julien Danjou 1723cc160a lua: introduce luaA_usemetatable
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-07-01 19:25:58 +02:00
Julien Danjou f2d2a10d9b lua: remove luaA_name_init
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-30 13:50:49 +02:00
Julien Danjou db88877587 lua: split getopt_string/getopt_lstring; fix mouse corner
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-25 17:33:05 +02:00
Julien Danjou ab5119732d use more tokenizer, with len
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-23 14:01:33 +02:00
Julien Danjou 92f369e3aa lua: userdata_new is now macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-18 18:31:35 +02:00
Pierre Habouzit 9ea15fd224 And migrate the rest of the loop to the libev.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-17 00:30:53 +02:00
Pierre Habouzit 476c851510 Migrate the lua server to the libev.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2008-06-16 23:51:11 +02:00
Julien Danjou 16646c86ab lua: __eq methods are not macros
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-16 11:37:55 +02:00
Julien Danjou 6e36717163 lua: _gc are now macros
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-16 11:31:38 +02:00
Julien Danjou 575fe8f9df [lua] Add several boolean functions
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-12 13:27:45 +02:00
Michael Gehring 4af0791499 [lua] Split luaA_parserc into luaA_init/parserc
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-09 08:52:00 +02:00
Julien Danjou 4c41361d6c [lua] Add object as argument to mouse click function
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-04 19:21:21 +02:00
Julien Danjou 98119d5d3f [lua] Check for object validity
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-06-04 18:27:10 +02:00
Julien Danjou be108acc32 [util] warn() and eprint() now print \n
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-05-23 22:56:05 +02:00
Julien Danjou 4bbb13b07a [build] Fix compilation issue with Lua pkg insalled as lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-05-20 19:02:40 +02:00
Julien Danjou 1f046b3c9f [everything] Switch from libconfuse to Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2008-05-20 18:01:15 +02:00