summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-03-12 04:48:33 +0800
committersumneko <sumneko@hotmail.com>2022-03-12 04:48:33 +0800
commitc461d51bf40563c3b74c652d8789ae302ea7c9e1 (patch)
treeefae279e57602aa19bc993dfcd10bd5990959313 /script/parser
parenta4baf8a43b0b25414d8fe08cb898e150d420e705 (diff)
downloadlua-language-server-c461d51bf40563c3b74c652d8789ae302ea7c9e1.zip
update
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 73857149..f490b306 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -1182,4 +1182,25 @@ function m.isOOP(source)
return false
end
+local baseTypeMap = {
+ ['unknown'] = true,
+ ['any'] = true,
+ ['true'] = true,
+ ['false'] = true,
+ ['nil'] = true,
+ ['boolean'] = true,
+ ['number'] = true,
+ ['string'] = true,
+ ['table'] = true,
+ ['function'] = true,
+ ['thread'] = true,
+ ['userdata'] = true,
+}
+
+---@param str string
+---@return boolean
+function m.isBaseType(str)
+ return baseTypeMap[str] == true
+end
+
return m