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

Function tableConcat

tablelib.go:52–83  ·  view source on GitHub ↗
(L *LState)

Source from the content-addressed store, hash-verified

50}
51
52func tableConcat(L *LState) int {
53 tbl := L.CheckTable(1)
54 sep := LString(L.OptString(2, ""))
55 i := L.OptInt(3, 1)
56 j := L.OptInt(4, tbl.Len())
57 if L.GetTop() == 3 {
58 if i > tbl.Len() || i < 1 {
59 L.Push(emptyLString)
60 return 1
61 }
62 }
63 i = intMax(intMin(i, tbl.Len()), 1)
64 j = intMin(intMin(j, tbl.Len()), tbl.Len())
65 if i > j {
66 L.Push(emptyLString)
67 return 1
68 }
69 //TODO should flushing?
70 retbottom := L.GetTop()
71 for ; i <= j; i++ {
72 v := tbl.RawGetInt(i)
73 if !LVCanConvToString(v) {
74 L.RaiseError("invalid value (%s) at index %d in table for concat", v.Type().String(), i)
75 }
76 L.Push(v)
77 if i != j {
78 L.Push(sep)
79 }
80 }
81 L.Push(stringConcat(L, L.GetTop()-retbottom, L.reg.Top()-1))
82 return 1
83}
84
85func tableInsert(L *LState) int {
86 tbl := L.CheckTable(1)

Callers

nothing calls this directly

Calls 15

LStringTypeAlias · 0.85
intMaxFunction · 0.85
intMinFunction · 0.85
LVCanConvToStringFunction · 0.85
CheckTableMethod · 0.80
OptStringMethod · 0.80
OptIntMethod · 0.80
stringConcatFunction · 0.70
PushMethod · 0.65
StringMethod · 0.65
TypeMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…