diff -r 5db1448eb857 -r 951f92c66821 lm.c --- a/lm.c Sat Feb 21 12:43:51 2009 +0200 +++ b/lm.c Sat Feb 21 16:10:28 2009 +0200 @@ -9,6 +9,15 @@ #include "lm_ssl.h" #include "lm_connection.h" +/// Some common principles: +/// Most methods can be used in two way: +/// * to get value they are invoked without their last argument. Returned value is either a value or pair of nil and error message. +/// * to set value they are invoked with last arg (value) specified. Returned value in most cases is an object, on which operation is performed (to allow chain-initialization). +/// Every object have pointer method to return pointer (lightuserdata) to underlying C loudmouth structure. +/// Every module have a bless method to convert given pointer (lightuserdata) to corresponding lua object. +/// Every unique C loudmouth object have only one corresponding lua object. Thus, result of "lm.message.bless ( message1:pointer () )" will be exactly message1 object (not its copy). +/// Where message handler object is expected, message handler function can be specified. However, you can unregister handler only if you have message handler object. + int luaopen_loudmouth (lua_State *L) { lua_pushstring (L, LLM_OBJREGISTRY); // 1 registry key