blob: 58893d663ea649b648507daa8b092194b9460acd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
local createValue = require 'vm.value'
local library = require 'core.library'
local libraryBuilder = require 'vm.library'
local sourceMgr = require 'vm.source'
return function (lsp)
local global = lsp and lsp.globalValue
if not global then
local t = {}
for name, lib in pairs(library.global) do
t[name] = libraryBuilder.value(lib)
end
global = t._G
global:set('_G', true)
for k, v in pairs(t) do
global:setChild(k, v)
global:addInfo('set child', sourceMgr.dummy(), k)
end
end
if lsp then
lsp.globalValue = global
end
return global
end
|