diff options
| author | ruki <[email protected]> | 2022-05-21 21:22:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-21 21:22:17 +0800 |
| commit | dbc34e84e8cbdaa3b2482e825b44aec311eafc1b (patch) | |
| tree | df9a56d68efc15bd8bc25801b5abe2a6b7d770c9 /xmake/core/base/bytes.lua | |
| parent | 56defbb27a476695f6527ecd633140221a7b7148 (diff) | |
add clear for bloom filter
Diffstat (limited to 'xmake/core/base/bytes.lua')
| -rw-r--r-- | xmake/core/base/bytes.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua index daf51bc81..1103c8f6a 100644 --- a/xmake/core/base/bytes.lua +++ b/xmake/core/base/bytes.lua @@ -47,7 +47,8 @@ function _instance.new(...) local instance = table.inherit(_instance) if type(arg1) == "number" then local size = arg1 - if type(arg2) == "cdata" then + local arg2_type = type(arg2) + if arg2_type == "cdata" or arg2_type == "userdata" then -- bytes(size, ptr [, manage]): mounts buffer on existing storage (manage memory or not) local ptr = arg2 local manage = arg3 @@ -62,9 +63,9 @@ function _instance.new(...) -- bytes(size[, init]): allocates a buffer of given size local init if arg2 then - if type(arg2) == "number" then + if arg2_type == "number" then init = arg2 - elseif type(arg2) == "string" then + elseif arg2_type == "string" then init = arg2:byte() else os.raise("invalid arguments #2 for bytes(size, ...), cdata, string, number or nil expected!") |
