Lines Matching refs:from
515 static int _copy_pool(lua_State *from, lua_State *to, LIBEVENT_THREAD *thr) { in _copy_pool() argument
517 mcp_pool_t *p = luaL_checkudata(from, -3, "mcp.pool"); in _copy_pool()
529 lua_pushvalue(from, -3); // dupe pool for referencing in _copy_pool()
530 mcp_gobj_ref(from, &p->g); // pops obj copy in _copy_pool()
534 static void _copy_config_table(lua_State *from, lua_State *to, LIBEVENT_THREAD *thr);
537 static void _copy_config_table(lua_State *from, lua_State *to, LIBEVENT_THREAD *thr) { in _copy_config_table() argument
538 int type = lua_type(from, -1); in _copy_config_table()
540 luaL_checkstack(from, 4, "configuration error: table recursion too deep"); in _copy_config_table()
548 if (lua_getmetatable(from, -1) != 0) { in _copy_config_table()
549 lua_pushstring(from, "__name"); in _copy_config_table()
550 if (lua_rawget(from, -2) != LUA_TNIL) { in _copy_config_table()
551 const char *name = lua_tostring(from, -1); in _copy_config_table()
553 _copy_pool(from, to, thr); in _copy_config_table()
556 mcp_ratelim_proxy_tbf(from, to); in _copy_config_table()
560 lua_pop(from, 2); in _copy_config_table()
563 proxy_lua_error(from, "unhandled userdata type in configuration table\n"); in _copy_config_table()
567 if (lua_isinteger(from, -1)) { in _copy_config_table()
568 lua_pushinteger(to, lua_tointeger(from, -1)); in _copy_config_table()
570 lua_pushnumber(to, lua_tonumber(from, -1)); in _copy_config_table()
574 lua_pushlstring(to, lua_tostring(from, -1), lua_rawlen(from, -1)); in _copy_config_table()
577 lua_pushboolean(to, lua_toboolean(from, -1)); in _copy_config_table()
584 int t = lua_absindex(from, -1); // static index of table to copy. in _copy_config_table()
586 lua_pushnil(from); // start iterator for main in _copy_config_table()
587 while (lua_next(from, t) != 0) { in _copy_config_table()
589 int keytype = lua_type(from, -2); in _copy_config_table()
598 lua_pushlstring(to, lua_tostring(from, -2), lua_rawlen(from, -2)); in _copy_config_table()
601 if (lua_isinteger(from, -2)) { in _copy_config_table()
602 lua_pushinteger(to, lua_tointeger(from, -2)); in _copy_config_table()
604 lua_pushnumber(to, lua_tonumber(from, -2)); in _copy_config_table()
608 … proxy_lua_error(from, "configuration table keys must be strings or numbers"); in _copy_config_table()
613 _copy_config_table(from, to, thr); // push next value. in _copy_config_table()
615 lua_pop(from, 1); // drop value, keep key. in _copy_config_table()
621 proxy_lua_error(from, "unhandled data type in configuration table\n"); in _copy_config_table()