Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to call field 'say' (a nil value) #108

Open
forging2012 opened this issue Nov 4, 2019 · 1 comment
Open

attempt to call field 'say' (a nil value) #108

forging2012 opened this issue Nov 4, 2019 · 1 comment

Comments

@forging2012
Copy link

follower this find error :
https://openresty.org/cn/using-luarocks.html

ERROR:

tail -f /usr/local/openresty/nginx/logs/error.log


2019/11/04 18:31:48 [error] 2028#2028: *2 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:68):3: attempt to call field 'say' (a nil value)
stack traceback:
coroutine 0:
	content_by_lua(nginx.conf:68): in main chunk, client: 127.0.0.1, server: localhost, request: "GET /luarocks HTTP/1.1", host: "localhost"


nginx.conf

    64	        location = /luarocks {
    65	            content_by_lua '
    66	                local foo = require("foo")
    67	                foo.say("hello, luarocks!")
    68	            ';
    69	        }
    70	
@agentzh
Copy link
Member

agentzh commented Nov 5, 2019

That page is obsolete and needs updates. We should use the following layout to define Lua modules instead:

local _M = {}

function _M.say()
...
end

return _M

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants