From e9cfdba22a43e4ef9caf29b4f711ab27231426a0 Mon Sep 17 00:00:00 2001 From: snail Date: Fri, 7 Aug 2015 10:38:57 +0800 Subject: [PATCH] 'hotfix' code cannot use '_ENV' If there's no global variable or function used in any interface of a snax service,the upvalue "_ENV" for 'hotfix' is not set. This modify is not complete, it depend's on the 'collect_uv' method having upvalue '_ENV',maybe other good method to get upvalue index of '_ENV'. --- lualib/snax/hotfix.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lualib/snax/hotfix.lua b/lualib/snax/hotfix.lua index 1a60383a..3a6e4e3e 100644 --- a/lualib/snax/hotfix.lua +++ b/lualib/snax/hotfix.lua @@ -49,7 +49,9 @@ local function collect_all_uv(funcs) collect_uv(v[4], global, envid(v[4])) end end - + if not global["_ENV"] then + global["_ENV"] = {func = collect_uv, index = 1} + end return global end