1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Merge state on vm:eval, new aliases need to be merged

This commit is contained in:
Étienne Fildadut 2021-12-02 19:24:48 +01:00
parent 721464218c
commit 607313d5ce
3 changed files with 18 additions and 9 deletions

View file

@ -32,9 +32,13 @@ local common
common = {
--- merge interpreter state with global state
merge_state = function(state)
local global_vars = state.interpreter.global_state.variables
local global = state.interpreter.global_state
for alias, fqm in pairs(state.aliases) do
global.aliases[alias] = fqm
state.aliases[alias] = nil
end
for var, value in pairs(state.variables) do
global_vars[var] = value
global.variables[var] = value
state.variables[var] = nil
end
end,