diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-17 13:50:38 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-17 13:50:38 +0800 |
commit | dfce55a48eb5f7f69bd64eba2b523b4e15e7e342 (patch) | |
tree | 21104eb9f101cdfc73657b2306bf6b2ddbf3fe0e /server/src/vm/library.lua | |
parent | 23ce4d049c7076edcd700fbac01554069c5de554 (diff) | |
download | lua-language-server-dfce55a48eb5f7f69bd64eba2b523b4e15e7e342.zip |
特殊处理pairs,使其返回真正的next
Diffstat (limited to 'server/src/vm/library.lua')
-rw-r--r-- | server/src/vm/library.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/src/vm/library.lua b/server/src/vm/library.lua index 6f038554..e1bd335e 100644 --- a/server/src/vm/library.lua +++ b/server/src/vm/library.lua @@ -5,6 +5,7 @@ local functionMgr local CHILD_CACHE = {} local VALUE_CACHE = {} +local Special = {} local buildLibValue local buildLibChild @@ -39,6 +40,9 @@ function buildLibValue(lib) func:setReturn(i, buildLibValue(rtn)) end end + if lib.special == 'pairs' then + func:setReturn(1, Special['next']) + end end elseif tp == 'string' then value = valueMgr.create('string', sourceMgr.dummy()) @@ -64,6 +68,10 @@ function buildLibValue(lib) end end + if lib.special == 'next' then + Special['next'] = value + end + return value end |