[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings
- From: Alexander Gladysh <agladysh@...>
- Date: Thu, 24 Mar 2011 21:38:21 +0300
On Thu, Mar 24, 2011 at 21:34, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
> 2011/3/24 Alexander Gladysh <agladysh@gmail.com>:
>> On Thu, Mar 24, 2011 at 20:40, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:
>>> Just use it as a key in the module
>>> table, which you previously set as all your lua_CFunction-s
>>> environment:
>>> {
>>> const char* redis_result;
>>> ... /* get a value for redis_result */
>>> lua_getfield(L, LUA_ENVIRONINDEX, redis_result);
>>> return 1;
>>> }
>> Looks like that, with some metatable magic, I even can create status
>> userdata on demand and not bother with pre-caching it.
> This qualifies as premature optimization too ;-)
> If you only have a few status codes, the metatable + metamethod
> creation may just cost more that pre-caching the values.
No, that is not about the speed here. I think that, probably, this
will make the code look better. We'll see :-)
Alexander.
- References:
- Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Robert G. Jakabosky
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Jerome Vuarand
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Jerome Vuarand
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Jerome Vuarand