diff options
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/hover/label.lua | 2 | ||||
-rw-r--r-- | script-beta/vm/eachDef.lua | 4 | ||||
-rw-r--r-- | script-beta/vm/getLibrary.lua | 38 |
3 files changed, 26 insertions, 18 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua index 942abe20..e82c9c6f 100644 --- a/script-beta/core/hover/label.lua +++ b/script-beta/core/hover/label.lua @@ -26,7 +26,7 @@ local function asValue(source, title) literal = vm.mergeViews(literal, util.viewLiteral(sl)) end if type == 'table' then - cont = buildTable(source) + cont = buildTable(src) end end) local pack = {} diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 2f29aa83..ec9af0da 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -9,7 +9,9 @@ local function eachDef(source) results[#results+1] = lib end if value then - results[#results+1] = value + vm.eachDef(value, function (res) + results[#results+1] = res + end) end return results end diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index 2af94440..395a5b74 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -6,16 +6,27 @@ local function checkStdLibrary(source) if source.library then return source end - if source.type ~= 'getglobal' - and source.type ~= 'setglobal' then - return - end - local name = guide.getName(source) - if not name then - return nil - end - if library.global[name] then + if source.type == 'getglobal' + or source.type == 'setglobal' then + local name = guide.getName(source) return library.global[name] + elseif source.type == 'select' then + local call = source.vararg + if call.type ~= 'call' then + goto CONTINUE + end + local func = call.node + local lib = vm.getLibrary(func) + if not lib then + goto CONTINUE + end + if lib.name == 'require' then + local modName = call.args[1] + if modName and modName.type == 'string' then + return library.library[modName[1]] + end + end + ::CONTINUE:: end end @@ -32,13 +43,8 @@ local function getLibInNode(source, nodeLib) end local function getNodeAsTable(source) - local node = source.node - if node.type ~= 'getglobal' - and node.type ~= 'setglobal' then - return - end - local name = guide.getName(node) - return getLibInNode(source, library.global[name]) + local nodeLib = checkStdLibrary(source.node) + return getLibInNode(source, nodeLib) end local function getNodeAsObject(source) |