skynet.forward

This commit is contained in:
云风
2012-09-11 12:59:02 +08:00
parent 908b10ef88
commit 481dfb85bb
2 changed files with 11 additions and 0 deletions

View File

@@ -229,6 +229,15 @@ _redirect(lua_State *L) {
return 0;
}
static int
_forward(lua_State *L) {
struct skynet_context * context = lua_touserdata(L, lua_upvalueindex(1));
uint32_t dest = luaL_checkunsigned(L,1);
skynet_forward(context, dest);
return 0;
}
static int
_error(lua_State *L) {
struct skynet_context * context = lua_touserdata(L, lua_upvalueindex(1));
@@ -276,6 +285,7 @@ luaopen_skynet_c(lua_State *L) {
{ "send" , _send },
{ "genid", _genid },
{ "redirect", _redirect },
{ "forward", _forward },
{ "command" , _command },
{ "callback" , _callback },
{ "error", _error },

View File

@@ -159,6 +159,7 @@ function skynet.send(addr, typename, ...)
end
skynet.genid = assert(c.genid)
skynet.forward = assert(c.forward)
skynet.redirect = function(dest,source,typename,...)
return c.redirect(dest, source, proto[typename].id, ...)