summaryrefslogtreecommitdiff
path: root/script/src/vm/raw.lua
blob: f8c35734583ba23ed3d90cf01d22d684eb9b1fb2 (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
26
27
28
29
30
local mt = require 'vm.manager'

function mt:callRawSet(func, values, source)
    local tbl = values[1]
    local index = values[2]
    local value = values[3]
    if not tbl or not index or not value then
        return
    end
    if index:getLiteral() then
        index = index:getLiteral()
    end
    tbl:addInfo('set child', source, index)
    tbl:rawSet(index, value, source)
    func:setReturn(1, tbl)
end

function mt:callRawGet(func, values, source)
    local tbl = values[1]
    local index = values[2]
    if not tbl or not index then
        return
    end
    if index:getLiteral() then
        index = index:getLiteral()
    end
    tbl:addInfo('get child', source, index)
    local value = tbl:rawGet(index)
    func:setReturn(1, value)
end