MCPcopy Index your code
hub / github.com/yuin/gopher-lua / RawSetString

Method RawSetString

table.go:202–222  ·  view source on GitHub ↗

RawSetString sets a given LValue to a given string index without the __newindex metamethod.

(key string, value LValue)

Source from the content-addressed store, hash-verified

200
201// RawSetString sets a given LValue to a given string index without the __newindex metamethod.
202func (tb *LTable) RawSetString(key string, value LValue) {
203 if tb.strdict == nil {
204 tb.strdict = make(map[string]LValue, defaultHashCap)
205 }
206 if tb.keys == nil {
207 tb.keys = []LValue{}
208 tb.k2i = map[LValue]int{}
209 }
210
211 if value == LNil {
212 // TODO tb.keys and tb.k2i should also be removed
213 delete(tb.strdict, key)
214 } else {
215 tb.strdict[key] = value
216 lkey := LString(key)
217 if _, ok := tb.k2i[lkey]; !ok {
218 tb.k2i[lkey] = len(tb.keys)
219 tb.keys = append(tb.keys, lkey)
220 }
221 }
222}
223
224// RawSetH sets a given LValue to a given index without the __newindex metamethod.
225func (tb *LTable) RawSetH(key LValue, value LValue) {

Callers 15

RawSetMethod · 0.95
RawSetHMethod · 0.95
OpenStringFunction · 0.95
RegisterModuleMethod · 0.80
SetFuncsMethod · 0.80
osDateFunction · 0.80
OpenBaseFunction · 0.80
OpenMathFunction · 0.80
OpenIoFunction · 0.80
initFunction · 0.80
debugGetInfoFunction · 0.80
initCallFrameMethod · 0.80

Calls 1

LStringTypeAlias · 0.85

Tested by

no test coverage detected