Lets say i have this map of project:
html
|- dir
|- file1.lua
|- file2.lua
If I writing in file1.lua
f2 = require "file2"
I lave fail down code parser with
/usr/local/openresty/nginx/html/dir/file1.lua:1: module 'file2' not found:
no field package.preload['file2']
no file '/usr/local/share/lua/5.1/file2.lua'
no file '/usr/local/openresty/lualib/file2.lua'
no file '/usr/local/openresty/nginx/html/file2.lua'
no file '/usr/local/openresty/site/lualib/file2.so'
no file '/usr/local/openresty/lualib/file2.so'
no file './file2.so'
no file '/usr/local/lib/lua/5.1/file2.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/file2.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
If i do same thing with console luaJIT i see that all ok and if I will delete file2.lua i watch next:
/usr/local/openresty/luajit/bin/luajit: file1.lua:1: module 'file2' not found:
no field package.preload['file2']
no file './file2.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/file2.lua'
no file '/usr/local/share/lua/5.1/file2.lua'
no file '/usr/local/share/lua/5.1/file2/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/file2.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/file2/init.lua'
no file './file2.so'
no file '/usr/local/lib/lua/5.1/file2.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/file2.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Difference between 1 and 2 output that first output have no:
no file './file2.lua'
string
As i understand openresty not trying to find any lua file in subdirs. It maps only from "html" dir because if i rewrite require like
local file2 = require "dir.file2" it works fine