qwzhou89 commented on issue #9856:
URL: https://github.com/apache/apisix/issues/9856#issuecomment-1641820881

   > 2\. Serverless cannot pass in program fragments, only one function can be 
passed in.
   
   That is not a fragments,that is a Closures.
   like https://apisix.apache.org/docs/apisix/plugins/serverless said:
   Closures are also legal:
   ```lua
   local count = 1
   return function()
       count = count + 1
       ngx.say(count)
   end
   ```
   Also, for the regular user, where do you put the code for such custom 
variables? That's where I'm putting it in Serverless right now. Except this 
time, it looks like it's executing fine
   ```lua
   local core = require "apisix.core"
   
   core.ctx.register_var("a6_route_labels", function(ctx)
       local route = ctx.matched_route and ctx.matched_route.value
       if route and route.labels then
           return route.labels
       end
       return nil
   end)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to