From 628a272b7babbeab995cf582ff4337b897ac09e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 13 Mar 2019 17:18:32 +0800 Subject: =?UTF-8?q?=E8=A7=A3=E9=99=A4value->info->source=E7=9A=84=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/source.lua | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'server/src/vm/source.lua') diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua index d53019c7..8f65da8b 100644 --- a/server/src/vm/source.lua +++ b/server/src/vm/source.lua @@ -1,6 +1,8 @@ local mt = {} mt.__index = mt -mt._hasInstant = true + +local Id = 0 +local List = {} function mt:bindLocal(loc, action) if loc then @@ -87,16 +89,25 @@ function mt:kill() self._bindCall = nil self._bindFunction = nil self._bindCallArgs = nil + List[self.id] = nil end function mt:isDead() return self._dead end -return function (vm, source) - if source._hasInstant then +local function instant(vm, source) + if source.id then return false end + Id = Id + 1 + source.id = Id + List[Id] = source setmetatable(source, mt) return true end + +return { + instant = instant, + list = List, +} -- cgit v1.2.3