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

Function strFormat

stringlib.go:136–146  ·  view source on GitHub ↗
(L *LState)

Source from the content-addressed store, hash-verified

134}
135
136func strFormat(L *LState) int {
137 str := L.CheckString(1)
138 args := make([]interface{}, L.GetTop()-1)
139 top := L.GetTop()
140 for i := 2; i <= top; i++ {
141 args[i-2] = L.Get(i)
142 }
143 npat := strings.Count(str, "%") - strings.Count(str, "%%")
144 L.Push(LString(fmt.Sprintf(str, args[:intMin(npat, len(args))]...)))
145 return 1
146}
147
148func strGsub(L *LState) int {
149 str := L.CheckString(1)

Callers

nothing calls this directly

Calls 6

LStringTypeAlias · 0.85
intMinFunction · 0.85
CheckStringMethod · 0.80
PushMethod · 0.65
GetTopMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…