, require d, ( main.lua):
local base_path = string.match(arg[0], '^(.-)[^/\\]*$')
package.path = string.format("%s;%s?.lua", package.path, base_path)
, , , require . Lua (Python , 2.6 ); , . base_path . , , SQLite, , :
local database_filename = base_path .. 'db.sqlite'
You can also make it base_pathglobal so that it is available to other modules, if necessary.
source
share