summaryrefslogtreecommitdiff
path: root/server/src/vm/raw.lua
blob: 31a8e8d13dfa38cab52e26df68ce8df932bd0ef1 (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
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)
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