lm.c
changeset 8 951f92c66821
parent 7 5db1448eb857
child 16 09b375e9ce32
equal deleted inserted replaced
7:5db1448eb857 8:951f92c66821
     6 #include "lm_message.h"
     6 #include "lm_message.h"
     7 #include "lm_message_handler.h"
     7 #include "lm_message_handler.h"
     8 #include "lm_proxy.h"
     8 #include "lm_proxy.h"
     9 #include "lm_ssl.h"
     9 #include "lm_ssl.h"
    10 #include "lm_connection.h"
    10 #include "lm_connection.h"
       
    11 
       
    12 /// Some common principles:
       
    13 /// Most methods can be used in two way:
       
    14 /// * to get value they are invoked without their last argument. Returned value is either a value or pair of nil and error message.
       
    15 /// * 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).
       
    16 /// Every object have pointer method to return pointer (lightuserdata) to underlying C loudmouth structure.
       
    17 /// Every module have a bless method to convert given pointer (lightuserdata) to corresponding lua object.
       
    18 /// 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).
       
    19 /// Where message handler object is expected, message handler function can be specified. However, you can unregister handler only if you have message handler object.
    11 
    20 
    12 int luaopen_loudmouth (lua_State *L)
    21 int luaopen_loudmouth (lua_State *L)
    13 {
    22 {
    14 	lua_pushstring (L, LLM_OBJREGISTRY); // 1 registry key
    23 	lua_pushstring (L, LLM_OBJREGISTRY); // 1 registry key
    15 	lua_newtable (L);                    // 2 registry value (table)
    24 	lua_newtable (L);                    // 2 registry value (table)