mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
snaxd change add package.path
This commit is contained in:
@@ -5,6 +5,7 @@ Dev version
|
|||||||
* add skynet.response and check multicall skynet.ret
|
* add skynet.response and check multicall skynet.ret
|
||||||
* skynet.newservice throw error when lanuch faild
|
* skynet.newservice throw error when lanuch faild
|
||||||
* Don't check imported function in snax.hotfix
|
* Don't check imported function in snax.hotfix
|
||||||
|
* snax service add change SERVICE_PATH and add it to package.path
|
||||||
|
|
||||||
v0.5.0 (2014-7-28)
|
v0.5.0 (2014-7-28)
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ return function (name , G, loader)
|
|||||||
|
|
||||||
setmetatable(G, { __index = env , __newindex = init_system })
|
setmetatable(G, { __index = env , __newindex = init_system })
|
||||||
|
|
||||||
|
local pattern
|
||||||
|
|
||||||
do
|
do
|
||||||
local path = skynet.getenv "snax"
|
local path = skynet.getenv "snax"
|
||||||
|
|
||||||
@@ -70,6 +72,7 @@ return function (name , G, loader)
|
|||||||
local filename = string.gsub(pat, "?", name)
|
local filename = string.gsub(pat, "?", name)
|
||||||
local f , err = loader(filename, "bt", G)
|
local f , err = loader(filename, "bt", G)
|
||||||
if f then
|
if f then
|
||||||
|
pattern = pat
|
||||||
mainfunc = f
|
mainfunc = f
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
@@ -90,5 +93,5 @@ return function (name , G, loader)
|
|||||||
G[k] = v
|
G[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
return func
|
return func, pattern
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,14 @@ local snax_interface = require "snax.interface"
|
|||||||
local profile = require "profile"
|
local profile = require "profile"
|
||||||
local snax = require "snax"
|
local snax = require "snax"
|
||||||
|
|
||||||
local func = snax_interface(tostring(...), _ENV)
|
local snax_name = tostring(...)
|
||||||
|
local func, pattern = snax_interface(snax_name, _ENV)
|
||||||
|
local snax_path = pattern:sub(1,pattern:find("?", 1, true)-1) .. snax_name .. "/"
|
||||||
|
package.path = snax_path .. "?.lua;" .. package.path
|
||||||
|
|
||||||
|
SERVICE_NAME = snax_name
|
||||||
|
SERVICE_PATH = snax_path
|
||||||
|
|
||||||
local mode
|
local mode
|
||||||
local thread_id
|
local thread_id
|
||||||
local message_queue = {}
|
local message_queue = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user