Skip to content

Instantly share code, notes, and snippets.

@itsmontoya
Created April 28, 2020 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsmontoya/ee731c00c191a73be1fc05713ae2cc43 to your computer and use it in GitHub Desktop.
Save itsmontoya/ee731c00c191a73be1fc05713ae2cc43 to your computer and use it in GitHub Desktop.
tmpl := l.GetGlobal("Tmpl").(*lua.LTable)
fmt.Println("Tmpl?", tmpl)
modifiers := tmpl.RawGetString("modifiers").(*lua.LTable)
fmt.Println("Modifiers?", modifiers)
modifiers.ForEach(func(k, v lua.LValue) {
fmt.Println("Modifier?", k, v)
})
if err := l.CallByParam(lua.P{
Fn: modifiers.RawGetString("firstName"),
NRet: 1,
Protect: true,
}, lua.LString("josh")); err != nil {
panic(err)
}
ret := l.Get(-1) // returned value
l.Pop(1) // remove received value
fmt.Println("Ret?", ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment