summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 3bebbc20..4f97b0e0 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1484,6 +1484,21 @@ local compilerSwitch = util.switch()
return
end
if func.special == 'require' then
+ if index == 2 then
+ local uri = guide.getUri(source)
+ local version = config.get(uri, 'Lua.runtime.version')
+ if version == 'Lua 5.3'
+ or version == 'Lua 5.4' then
+ vm.setNode(source, vm.declareGlobal('type', 'unknown'))
+ else
+ vm.setNode(source, vm.declareGlobal('type', 'nil'))
+ end
+ return
+ end
+ if index >= 3 then
+ vm.setNode(source, vm.declareGlobal('type', 'nil'))
+ return
+ end
if not args then
return
end