From a8a1261f7bce7a45bc670fefffd4ebd6f3e946b3 Mon Sep 17 00:00:00 2001 From: nianhua Date: Wed, 26 Jun 2024 02:35:42 +0800 Subject: [PATCH] Update localstorage.lua --- target/localstorage.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/target/localstorage.lua b/target/localstorage.lua index 6f6d5c4..8823950 100644 --- a/target/localstorage.lua +++ b/target/localstorage.lua @@ -6,9 +6,14 @@ localstorage.__index = localstorage 创建一个新的 fw_localstorage 对象 @return 返回一个新的 fw_localstorage 对象 ]] -function localstorage.new() +function localstorage.new(db) local instance = setmetatable({}, localstorage) - instance.module = fw_localstorage.new() + if db == nil then + instance.module = fw_localstorage.new() + else + instance.module = db + end + return instance end