blob: ba5da73ac31ac43540a64c03aab5cb175143010e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
local createValue = require 'vm.value'
local library = require 'core.library'
local libraryBuilder = require 'vm.library'
return function (lsp)
local global = lsp and lsp.globalValue
if not global then
global = createValue('table')
for name, lib in pairs(library.global) do
if not global:rawGet(name) then
local value = libraryBuilder.value(lib)
global:rawSet(name, value)
end
end
end
if lsp then
lsp.globalValue = global
end
return global
end
|