You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's said in the section Lua Variable Scope that each request handler has its own set of Lua global variables.But It's not so in the source code here:
Only the version built without OpenResty's LuaJIT(eg. without the micro OPENRESTY_LUAJIT) can have a new table as global environment in each lua coroutine.
I also did experiment on two versions of OpenResty, one was built with OpenResty's LuaJIT and the other is built with official version of LuaJIT. I created two locations to set and get global variable like this:
location= /set {
content_by_lua_block { key=1 ngx.say("set global key!") }
}
location/ {
content_by_lua_block { ngx.say(key or "nil")}
}
In the result, the OpenResty's LuaJIT version successfully got the gloabl 'key' and the other version did't.
So why does lua-nginx has this global environment setting with different luajit version? Why doesn't OpenResty's LuaJIT need isolated global environment?
The text was updated successfully, but these errors were encountered:
OpenResty version used in my issue: 1.21.4.3
It's said in the section Lua Variable Scope that each request handler has its own set of Lua global variables.But It's not so in the source code here:
Only the version built without OpenResty's LuaJIT(eg. without the micro OPENRESTY_LUAJIT) can have a new table as global environment in each lua coroutine.
I also did experiment on two versions of OpenResty, one was built with OpenResty's LuaJIT and the other is built with official version of LuaJIT. I created two locations to set and get global variable like this:
In the result, the OpenResty's LuaJIT version successfully got the gloabl 'key' and the other version did't.
So why does lua-nginx has this global environment setting with different luajit version? Why doesn't OpenResty's LuaJIT need isolated global environment?
The text was updated successfully, but these errors were encountered: