Re: Some usefull feature from lua 5.2

  • From: Denis F <deniska.nm@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 10 Jul 2015 10:38:23 +0300

Yes, this is more logical solution.
But, i took this solution from lua 5.2 source code. lua 5.3 have the same
source code.
I think, it depends on LUA internal lua_State manipulations.

Bug in my patch code.

file - lj_state.c
in function
lua_State *lj_state_new(lua_State *L)
{
// Old wrong string
lua_State *L1 = tostate(lj_mem_newobj(L, lua_State));


// New right string
lua_State *L1 = tostate(lj_mem_newobj(L, LX));

...
}

2015-07-10 9:49 GMT+03:00 Roman Tsisyk <roman@xxxxxxxxxxxxx>:




Wednesday, July 8, 2015 8:48 AM +03:00 from Denis F <
deniska.nm@xxxxxxxxx>:


Hello, All :)

LUA 5.2 have very usefull feature. It helps to associete some user
context with lua_state.
Short description from lua docs.

+/*
+** thread state + extra space
+*/
+typedef struct LX {
+ char extra_[LUA_EXTRASPACE];
+ lua_State l;
+} LX;

Why don't add char extra_[LUA_EXTRASPACE]; to lua_State itself?

--
WBR,
Roman Tsisyk <roman@xxxxxxxxxxxxx>
http://tarantool.org/ - an efficient in-memory data store and a Lua
application server

Other related posts: