lua-users home
lua-l archive

Search lua-l

This index contains 143,615 documents and 1,774,615 keywords. Last update on 2023-03-09 .

Query: [How to search]

Display: Description: Sort by:

Results:

References: [ Luis: 514 ] [ Carvalho: 322 ]

Total 256 documents matching your query.

121. Re: tables as keys (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Tue, 11 Mar 2008 11:08:49 -0400
Here are my $.02: -- special.lua local pairs, setmetatable = pairs, setmetatable local assert, type, tostring = assert, type, tostring local sort = function(t) -- tostring can be any serializer tabl
122. Re: Index with multiple parameters? (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Wed, 20 Feb 2008 04:57:47 -0500
Along these lines, have you tried caching temporary objects? You could use something like this quick prototype: -- vector.lua local getmetatable, assert = getmetatable, assert local newproxy, ipairs
123. Re: String tainting (score: 27)
Author: "Dirk Feytons" <dirk.feytons@...>
Date: Mon, 11 Feb 2008 12:00:37 +0100
Nice! This should be a good starting point; thanks. A few remarks: - Your __concat function doesn't make the new string tainted if one of its parts is tainted. Easy to fix though. - Some extra code i
124. Re: String tainting (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Fri, 8 Feb 2008 11:39:57 -0500
Oops! This is better: local strindex = getmetatable"".__index mt.__index = function(o, k) local s = strings[o] return k == "string" and s or strindex[k] end Sorry for the noise. Cheers, Luis. -- A m
125. Re: String tainting (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Fri, 8 Feb 2008 11:21:11 -0500
You could get away with something like: -- taint.lua local newproxy, getmetatable, tostring = newproxy, getmetatable, tostring module(...) local strings = {} -- tainted strings local tainted = newpr
126. Re: string like arrays (score: 26)
Author: Marco Antonio Abreu <falecomigo@...>
Date: Wed, 16 Jan 2008 22:22:33 -0200
Thanks everyone, I already tried something like this, but it introduces more code in the middle reducing performance. About to write, I thought the answer will be this one (immutable). Anyway, thank
127. Re: string like arrays (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Tue, 15 Jan 2008 19:39:13 -0500
Not with Lua strings since they're immutable. But you can roll something like: function mutstring (s) assert(type(s) == "string", "string expected") local ms = s or "" local u = newproxy(true) local
128. [ANN] PL/Lua (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Mon, 7 Jan 2008 19:28:54 -0500
Hi, I'm happy to announce the availability of PL/Lua, a procedural language handler for Lua in PostgreSQL! More details can be found at: http://pllua.projects.postgresql.org Any feedback is welcome!
129. Re: Priority Queue (score: 438)
Author: Luis Carvalho <carvalho@...>
Date: Sat, 17 Nov 2007 16:17:17 -0500
You might find this useful: http://lua-users.org/lists/lua-l/2007-07/msg00482.html Cheers, Luis. -- A mathematician is a device for turning coffee into theorems. -- P. Erdos -- Luis Carvalho Applied
130. Re: multidimensional numerical arrays (score: 61)
Author: "Wesley Smith" <wesley.hoke@...>
Date: Sat, 18 Aug 2007 10:04:21 -0700
Thanks for the suggestions. I looked at it for a bit but it seems too tied up in Lua and not really suitable for 8-bit video data or holding texture data. I'm looking for something that's not only fl
131. Re: multidimensional numerical arrays (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Sat, 18 Aug 2007 12:04:29 -0400
<shameless-plug> There is a numerical array module, but it's neither standard nor it supports integers: http://numlua.luaforge.net </shameless-plug> Cheers, Luis. -- A mathematician is a device for
132. Re: Tuple (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Fri, 17 Aug 2007 11:15:31 -0400
Actually, only tupleF and newtuple are necessary; the remaining methods are just for convenience. really nice to have for comparing tuple upvalues (I do have __eq for tuples in case Lua 5.2 supports
133. Re: Tuple (score: 27)
Author: David Manura <dm.lua@...>
Date: Fri, 17 Aug 2007 03:03:51 +0000 (UTC)
PiL, 2nd ed., 27.3, implements a more minimal form of that same idea. (PiL also omits the n <= LUA_MINSTACK check, which I think is ok.) Your example does illustrate a case where it would be useful f
134. RE: Iteration and nils (score: 18)
Author: "Jerome Vuarand" <jerome.vuarand@...>
Date: Thu, 16 Aug 2007 12:12:00 -0400
I thought that a new iterator on ... would solve the problem without having to modify the language. I found out while looking for 'apairs' that it was proposed last year by Mark Hamburg [1], with the
135. Tuple (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Thu, 16 Aug 2007 10:57:54 -0400
Hi, I decided to put together a simple tuple implementation based on previous discussions in the list (check attachment). It contains a constructor, tuple, and an iterator, ituple. Some usage example
136. Re: Iteration and nils (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Thu, 16 Aug 2007 09:22:48 -0400
<snip> Another approach -- already mentioned several times here -- is to use tuples. You could then pass and return tuples to/from vararg functions. It would be easy to iterate over them (similarly
137. Re: __eq in shared metatables (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Sat, 11 Aug 2007 11:17:44 -0400
Hi David, Thanks for your thorough explanation. Please see my comments below. <snip> That makes a lot of sense now; I was considering metamethods as behavior changers, not as behavior definers for ou
138. Re: __eq in shared metatables (score: 27)
Author: David Manura <dm.lua@...>
Date: Sat, 11 Aug 2007 04:46:53 +0000 (UTC)
I think you're right about the manual where it says "eq" is defined as function eq_event (op1, op2) if type(op1) ~= type(op2) then -- different types? return false -- different objects end if op1 ==
139. Re: __eq in shared metatables (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Fri, 10 Aug 2007 16:38:08 -0400
Not for me (not that I would define __eq for numbers; this is just an example). What about functions? I can understand why you don't have individual metatables for functions, but why not __eq? From
140. __eq in shared metatables (score: 447)
Author: Luis Carvalho <carvalho@...>
Date: Fri, 10 Aug 2007 15:56:35 -0400
Hi, Is there any reason why __eq is not called when the metatable is shared for a type other than table and userdata? $ lua Lua 5.1.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio 1 false Since there are

Search by Namazu v2.0.21