Reputation: 33
I have an issue with attempting to utilize ngx on any of the lua coding in ZeroBrane Studio, including resty.cookie. Am I doing something wrong? (This is in Windows)
I have OpenResty downloaded, but I have no idea how to compile the ngx inside despite looking at multiple instructions on how to do so, as all of the attempt made on debugging always results in "attempt to index global 'ngx' (a nil value)".
EDIT: To rephrase, I am using ZeroBrane Studios, OpenResty and StrawberryPerl. I am trying to utilize resty.cookie that I had downloaded via LuaRocks to pull a cookie from a certain site (httpbin.org). However, I noticed that whenever I run the debugger, it ends up with "attempt to index global 'ngx' (a nil value)" at the "require resty.cookie" line. I decided to look at the guide that was shown in the website. It showed the same thing, so I have no idea how to fix this issue.
Upvotes: 2
Views: 4740
Reputation: 7056
I think you mistakenly believe that openresty is some sort of Lua library that lets you do HTTP stuff. It's not. Nginx is a web server and OpenResty is just a modified version of it that lets you generate your websites dynamically using Lua.
If you want to communicate over HTTP from within plain Lua, you need something different (like Luasocket or LuaHTTP).
Upvotes: 1