[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 23:32:38 +0300
On Thu, Mar 24, 2011 at 21:38, Alexander Gladysh <agladysh@gmail.com> wrote:
> 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 :-)
Note also that I do not know ahead of time exactly what status string
Redis will send me. So I will have to extend the table in run-time
anyway.
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
- Re: Error handling strategy for Redis multi-bulk replies, in context of Lua bindings, Alexander Gladysh