最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nginx - How to load module using a variable with Lua in Openresty? - Stack Overflow

programmeradmin3浏览0评论

Trying to load modules based on a value in a variable. Is this possible?

local moduletoload = "login"    
local mod_action = require moduletoload

Thanks

Trying to load modules based on a value in a variable. Is this possible?

local moduletoload = "login"    
local mod_action = require moduletoload

Thanks

Share Improve this question asked Jan 20 at 3:56 DanDan 2,4895 gold badges31 silver badges50 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

When the argument is a string or table, you can omit parentheses, which is specified by Lua, but in other cases parentheses must be used.

local mod_action = require(moduletoload)
发布评论

评论列表(0)

  1. 暂无评论