diff options
Diffstat (limited to 'script/vm/raw.lua')
-rw-r--r-- | script/vm/raw.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/script/vm/raw.lua b/script/vm/raw.lua new file mode 100644 index 00000000..f8c35734 --- /dev/null +++ b/script/vm/raw.lua @@ -0,0 +1,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 |