lua-users home
lua-l archive

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


  I'm currently working on a proof-of-concept and I've come across a rather
odd ommision in the Lua API:  there exists no lua_pushuserdata().

  I've created the structure using lua_newuserdata() and it exists on the
Lua stack at that point, but there seems to be no way, short of storing it
in some table, to *get* that structure back on the Lua stack (I'm trying to
resume a coroutine which takes as a parameter, the userdata I've
constructed).

  I'd rather not have to go through

	blob = lua_newuserdata(...);
	lua_setglobal(L,"dummy");
  	...
	lua_getglobal(L,"dummy");

since the project is creating multiple Lua threads (and keeping track of all
the blobs I'm creating through Lua would complicate things, as I'm already
keeping track of all the blobs via the C code).  

  I can easily add the lua_pushuserdata() function myself, but I just find
it odd that it's missing from the published API.

  -spc (Oversight maybe?)