Search lua-l
This index contains 143,615 documents and
1,774,615 keywords. Last update on
2023-03-09 .
- 141. Re: lists with nil play nice for Lua 5.2 (score: 27)
- Author: Mark Hamburg <mhamburg@...>
- Date: Wed, 08 Aug 2007 13:20:30 -0700
- The lack of support there is one of the things that makes select feel crude. (The invitation to experience n-squared time complexity is a bigger problem with select.) How do we index in Lua? Using []
- 142. Re: lists with nil play nice for Lua 5.2 (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Wed, 8 Aug 2007 15:38:34 -0400
- <snip> I think your proposal 3 would be an implementation of proposal 2 in the sense that (functional) tuples could substitute select. Why would you need #tuple and tuple[idx]? select does not have
- 143. Re: setmetatable vs debug.setmetatable? (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Fri, 3 Aug 2007 10:21:30 -0400
- Try this: newf = function(f, l) local p = newproxy(true) local mt = getmetatable(p) mt.__call = function(_, ...) return f(...) end mt.__len = function() return l end return p end Cheers, Luis. -- A
- 144. RE: Priority Queues? (score: 26)
- Author: "Grellier, Thierry" <t-grellier@...>
- Date: Thu, 26 Jul 2007 14:07:44 +0200
- Maybe off topic, but SystemC (www.systemc.org) can be used as a discrete event simulation system, and maybe provide all you need although it is pure c++, and you already have a simulation engine. You
- 145. Re: Priority Queues? (score: 26)
- Author: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 26 Jul 2007 10:27:50 +1200
- Thanks everyone for the replies. I hope you don't mind me collating them into one mail to reply to you all. No, I didn't. I googled "lua priority queue" a fair bit, and missed this, so thanks! Both t
- 146. Re: Priority Queues? (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Wed, 25 Jul 2007 11:49:50 -0400
- <snip> You should try a pure Lua solution first, and see if that's efficient enough for you since it'd be easier to write and maintain. Here's a simple implementation: -- Heap.lua -- A simple priori
- 147. Re: luaL_Buffer and 'exception safety' (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Fri, 20 Jul 2007 10:39:02 -0400
- <snip> You could use a simpler approach and have read_data accept a putc-like function that writes one char at a time, void read_data (void (*write_char)(char c, void *v), void *data); and leave the
- 148. Re: Prevent table insertions? (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Tue, 5 Jun 2007 18:22:12 -0400
- You can use a userdata proxy: function readonly(t) local u = newproxy(true) local mt = getmetatable(u) mt.__index = t mt.__newindex = function() error("attempt to update a read-only table", 2) end m
- 149. Re: Simple pickler (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Fri, 18 May 2007 22:20:01 -0400
- Ok, it's not that big after all. :) The code is attached. As a simple test, run: require "pickler" a = {x = 1, y = 2; {3, 4, 5}} a[2] = a -- cycle a.z = a[1] -- shared subtable a.f = function(n) ret
- 150. Re: Simple pickler (score: 18)
- Author: Bertrand Mansion <golgote@...>
- Date: Sat, 19 May 2007 02:59:04 +0200
- Le 18 mai 07 à 19:31, Luis Carvalho a écrit : I've updated the pickler code with your suggestions and a few changes, and it's now in version 0.2. I can post it later (wiki?) if there's enough interes
- 151. Re: Simple pickler (score: 18)
- Author: PA <petite.abeille@...>
- Date: Fri, 18 May 2007 20:29:11 +0200
- I've updated the pickler code with your suggestions and a few changes, and it's now in version 0.2. I can post it later (wiki?) if there's enough interest, or send the code privately. Very nice. Woul
- 152. Re: Simple pickler (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Fri, 18 May 2007 13:31:10 -0400
- Hi Thomas, Right, thanks for spotting this! Bug reports are never a nuisance. :) It's there just for the sake of completeness. However, there might be cases in which you want to build a custom pickle
- 153. Re: Simple pickler (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Thu, 17 May 2007 23:40:00 -0400
- This is fine; I've updated the code. I've settled down with <esc>LPK<version in hex> as the signature, and a few more functions for file parsing are now in the module. Now you can do: require "pickl
- 154. Re: Simple pickler (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Thu, 17 May 2007 10:23:40 -0400
- Well, it kinda asks for it, isn't it? :) No, I missed the obvious. You are right. I just took this code from one of Roberto's examples while I was playing with struct and forgot to adapt it later. T
- 155. Re: Simple pickler (score: 27)
- Author: Thomas Lauer <thomas.lauer@...>
- Date: Thu, 17 May 2007 13:01:14 +0100
- Funny, I was just at the point of writing exactly that sort of thing, though based on my own, more Perl-oriented pack/unpack code. One quick remark after skimming the code. In pickle() I see this: an
- 156. Simple pickler (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Wed, 16 May 2007 20:52:46 -0400
- Hi, I've just found out about Roberto's struct lib, and so I thought it would not be hard to come up with a simple pickle/unpickle module. I'm sharing it here, since it's small, in case anyone is int
- 157. [OT] Re: [ANN] MD5 1.0.2 Released (OT) (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Thu, 10 May 2007 10:51:32 -0400
- If pc is the probability of collision ~ 1e-20, and n is the number of blocks, then p1 = P(at least one collision) = 1 - P(no collision) = 1 - (1 - pc)^c2(n), where c2(n) is (n choose 2) = n*(n-1)/2,
- 158. Re: Newbie questions regarding luasocket, tables (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Wed, 9 May 2007 16:44:07 -0400
- Right. No, and newproxy is undocumented and unsupported. The motivation is given by Roberto: "This is a very experimental feature. We wanted a simple and secure way of creating userdata in Lua. It h
- 159. Re: Newbie questions regarding luasocket, tables (score: 26)
- Author: Bradley Smith <gmane@...>
- Date: Tue, 08 May 2007 16:20:55 -0700
- If you really, really need to know the number of key-value pairs in your table (which is probably not the case, as Javier suggested), you can try this: The example below introduced me to the newproxy
- 160. Re: Newbie questions regarding luasocket, tables (score: 447)
- Author: Luis Carvalho <carvalho@...>
- Date: Tue, 8 May 2007 13:47:31 -0400
- If you really, really need to know the number of key-value pairs in your table (which is probably not the case, as Javier suggested), you can try this: -- hash.lua local new = function() local t = {
Search by
Namazu v2.0.21