Come in learning and Chun of the openresty, the individual to Lua is not very skilled, will inevitably encounter a lot of strange problems, here is a little record of some small problems encountered, for others reference.
Internet search related information, most of the information is just to call Lua require or dofile, and the details of the difference between the life, not to say useless, but did not answer my question-how to implement the variable between LUA files on the openresty server?
First, you have to specify the path to the require, and you need to configure the variable "lua_package_path/topath/" inside the HTTP segment. LUA;; ", notice here that the" Topath "is the absolute path and the back two semicolon";; " Can't save.
The variables are then defined in the Lua file (Config.lua) where the variables need to be defined, such as I want to define a table, which should define "table = {a=1, b=2}". Be careful not to add "local" to the front, otherwise you cannot read it.
The last is to refer to Config.lua's global variables in the logical processing LUA, you need to call require ("config"), load the file in, and then call the member of table, directly "TABLE.A" can access the value of a.
How does a LUA file invoke a variable of another LUA file?