From 596f7a5634651f802cb83ea736d05b50bcd55b26 Mon Sep 17 00:00:00 2001 From: notomo Date: Thu, 6 Jun 2024 20:40:05 +0900 Subject: [PATCH] Change is_promise impl to use with vendored promise --- lua/promise/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/promise/init.lua b/lua/promise/init.lua index 628f61f..ef85fe7 100644 --- a/lua/promise/init.lua +++ b/lua/promise/init.lua @@ -26,13 +26,16 @@ function PackedValue.first(self) end --- @class Promise -local Promise = {} +local Promise = { + _is_promise = true, +} Promise.__index = Promise local PromiseStatus = { Pending = "pending", Fulfilled = "fulfilled", Rejected = "rejected" } local is_promise = function(v) - return getmetatable(v) == Promise + local tbl = getmetatable(v) + return tbl ~= nil and tbl._is_promise == true end local new_empty_userdata = function()