moonbridge

diff moonbridge.c @ 131:89fc89b22e28

Example application uses new "main" protocol; Handler for "main" gets table with "main" set to true
author jbe
date Wed Apr 15 00:59:52 2015 +0200 (2015-04-15)
parents ee98e12427a9
children 11269ec33cd7
line diff
     1.1 --- a/moonbridge.c	Wed Apr 15 00:54:17 2015 +0200
     1.2 +++ b/moonbridge.c	Wed Apr 15 00:59:52 2015 +0200
     1.3 @@ -794,11 +794,16 @@
     1.4      lua_rawgetp(L, LUA_REGISTRYINDEX, moonbr_luakey_connect_func(pool));
     1.5      if (fd < 0) {
     1.6        lua_newtable(L);
     1.7 -      lua_pushstring(L,
     1.8 -        listener->type_specific.interval.name ?
     1.9 -        listener->type_specific.interval.name : ""
    1.10 -      );
    1.11 -      lua_setfield(L, -2, "interval");
    1.12 +      if (listener->proto == MOONBR_PROTO_MAIN) {
    1.13 +        lua_pushboolean(L, 1);
    1.14 +        lua_setfield(L, -2, "main");
    1.15 +      } else if (listener->proto == MOONBR_PROTO_INTERVAL) {
    1.16 +        lua_pushstring(L,
    1.17 +          listener->type_specific.interval.name ?
    1.18 +          listener->type_specific.interval.name : ""
    1.19 +        );
    1.20 +        lua_setfield(L, -2, "interval");
    1.21 +      }
    1.22      } else {
    1.23        lua_pushvalue(L, -2);
    1.24      }

Impressum / About Us