lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 4, 2011 at 01:16, C++ RTMP Server <crtmpserver@gmail.com> wrote:
>
> On Apr 4, 2011, at 3:09 AM, Alexander Gladysh wrote:
>
>> On Mon, Apr 4, 2011 at 02:39, Robert G. Jakabosky <bobby@sharedrealm.com> wrote:
>>> On Sunday 03, C++ RTMP Server wrote:
>>
>>> If you want to use the standard Lua VM library without modifications, then you
>>> can't use the extra space feature.  It is up to you to decide which method you
>>> use to do what you need.
>>
>>> It is not un-common for projects to embed a customized version of Lua VM core.
>>> Lua is small enough that this doesn't add a burden on the main project.
>>
>> Before messing with custom allocators, extra state spaces and other
>> customizations, think hard: do you need to be able to embed LuaJIT 2
>> in your project? (Hint: you do, and it does not live well with all of
>> this.)
> Ok, I think I need to take a deep breath calm down, and rethink all of this, especially the memory allocator :)
>
> However, I do need that one-to-one association between lua state and my server state. There is no way I can bypass that because the server have very complex state and resources manager(s). I'm basically using lua as a scripting engine not the other way around: provide atomic (simplistic) functionality to lua language through implementing simple libs (main loop resides in the server).
>
> For the time being, I think I will go Robert's way or at least abstract myself from this using a well designed functions/defines
>
> Wishful thinking here... Is it possible to provide such an infrastructure in the future for lua (keeping custom states)? I've seen this pattern in many other pieces of software. For example kqueue system which is really powerful because of this (and not only)
>
> Tx a lot for the advices :)
>
>>
>> Alexander.
>>
>
> ------
> Eugen-Andrei Gavriloaie
> Web: http://www.rtmpd.com
>
>
>

You mentioned before a system that maps lua_States to your app data
and back using two maps. If you stored that app data in a struct which
also contains the lua_State* that corresponds to it, you'd only need
one map (state -> app data struct).

-- 
Sent from my toaster.