From 1760eafa1d2ebce8f07e11414a53d4a251af5b8e Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Fri, 18 Feb 2011 20:33:43 +0100 Subject: * keeper.lua is now embedded in text form instead of bytecode to improve LuaJIT2-compatibility (but this is not enough). * moved keeper-related code in a separate source file --- docs/index.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index 03c91f7..a28dd41 100644 --- a/docs/index.html +++ b/docs/index.html @@ -799,8 +799,31 @@ can be used for custom userdata as well. Here's what to do.

  1. Provide an identity function for your userdata, in C. This function is -used for creation and deletion of your deep userdata (the shared resource), -and for making metatables for the state-specific proxies for accessing it. + used for creation and deletion of your deep userdata (the shared resource), + and for making metatables for the state-specific proxies for accessing it. The + prototype is + + +
    + void idfunc( lua_State *L, char const * const which); +
    +which can be one of: +
      +
    • + "new": requests the creation of a new object, whose pointer is pushed on the stack + as a light userdata. +
    • +
    • + "delete": receives this same pointer on the stack, and should cleanup the object.
    • +
    • + "metatable": should build a metatable for the object. Don't cache the metatable +yourself, Lanes takes care of it ("metatable" should only be invoked once).
    • +
    • + "module": is the name of the module that exports the idfunc, +to be pushed on the stack as a string. It is necessary so that Lanes can require it in +any Lane and keeper state that receives a userdata. This is to prevent crashes in situations +where the module could be unloaded while the idfunc pointer is still held.
    • +
    Take a look at linda_id in lanes.c.
  2. Instanciate your userdata using luaG_deep_userdata(), -- cgit v1.2.3-55-g6feb