我在使用 stream-lua-nginx-module 模块尝试写一个 echo server的时候, 使用content_by_lua_file调用脚本/logic/entry.lua,
2018/01/04 16:15:45 [error] 9380#11936: *1 failed to load external Lua file "./logic/entry.lua": ./logic/entry.lua:2: '=' expected near 'package', client: 127.0.0.1, server: 0.0.0.0:9999
worker_processes 1;error_log logs/error.log;events { worker_connections 1024;}stream { init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' } server { listen 9999; content_by_lua_file logic/entry.lua; }}
package.path = package.path ..';.\\logic\\?.lua';local m_stream = require("stream")local _M = {}function _M.handle_requset_socket( self ) return m_stream:handle_request_stream()end_M:handle_requset_socket()return _M
init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' }
在 2018年1月4日,下午4:23,luke <xzzh...@gmail.com> 写道:Hi~我在使用 stream-lua-nginx-module 模块尝试写一个 echo server的时候, 使用content_by_lua_file调用脚本/logic/entry.lua,同时,在entry.lua中又调用同一logic目录的其它脚本,结果报错:2018/01/04 16:15:45 [error] 9380#11936: *1 failed to load external Lua file "./logic/entry.lua": ./logic/entry.lua:2: '=' expected near 'package', client: 127.0.0.1, server: 0.0.0.0:9999nginx.conf 是这样的:worker_processes 1;error_log logs/error.log;events { worker_connections 1024;}stream { init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' } server { listen 9999; content_by_lua_file logic/entry.lua; }}entry.lua是这样的:package.path = package.path ..';.\\logic\\?.lua';local m_stream = require("stream")local _M = {}function _M.handle_requset_socket( self ) return m_stream:handle_request_stream()end_M:handle_requset_socket()return _M为什么呢?最好的放置搜索路径的位置的方式是什么? -- --
hello,init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' } 使用绝对路径,如/path/to/logic/?.lua;Kwanhur HuangTL;DR 在 2018年1月4日,下午4:23,luke <xzzh...@gmail.com> 写道:Hi~我在使用 stream-lua-nginx-module 模块尝试写一个 echo server的时候, 使用content_by_lua_file调用脚本/logic/entry.lua,同时,在entry.lua中又调用同一logic目录的其它脚本,结果报错:2018/01/04 16:15:45 [error] 9380#11936: *1 failed to load external Lua file "./logic/entry.lua": ./logic/entry.lua:2: '=' expected near 'package', client: 127.0.0.1, server: 0.0.0.0:9999nginx.conf 是这样的:worker_processes 1;error_log logs/error.log;events { worker_connections 1024;}stream { init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' } server { listen 9999; content_by_lua_file logic/entry.lua; }}entry.lua是这样的:package.path = package.path ..';.\\logic\\?.lua';local m_stream = require("stream")local _M = {}function _M.handle_requset_socket( self ) return m_stream:handle_request_stream()end_M:handle_requset_socket()return _M为什么呢?最好的放置搜索路径的位置的方式是什么? --
在 2018年1月4日,下午4:23,luke <xzzh...@gmail.com> 写道:Hi~我在使用 stream-lua-nginx-module 模块尝试写一个 echo server的时候, 使用content_by_lua_file调用脚本/logic/entry.lua,同时,在entry.lua中又调用同一logic目录的其它脚本,结果报错:2018/01/04 16:15:45 [error] 9380#11936: *1 failed to load external Lua file "./logic/entry.lua": ./logic/entry.lua:2: '=' expected near 'package', client: 127.0.0.1, server: 0.0.0.0:9999nginx.conf 是这样的:worker_processes 1;error_log logs/error.log;events { worker_connections 1024;}stream { init_by_lua_block { package.path = package.path .. ';.\\logic\\?.lua;' } server { listen 9999; content_by_lua_file logic/entry.lua; }}entry.lua是这样的:package.path = package.path ..';.\\logic\\?.lua';local m_stream = require("stream")local _M = {}function _M.handle_requset_socket( self ) return m_stream:handle_request_stream()end_M:handle_requset_socket()return _M为什么呢?最好的放置搜索路径的位置的方式是什么? --