Skip to main content

rawset

Function rawset 

Source
pub fn rawset(t: table, index: any, value: any) -> table
Expand description

Sets the real value of t[index] to value, without using the __newindex metamethod. t must be a table, index any value different from nil and NaN. Returns t.

§Examples

local t = setmetatable({}, { __newindex = function() error("read-only") end })
rawset(t, "k", 1)      -- bypasses __newindex
print(t.k)             --> 1