mirror of
https://github.com/hanzoai/gateway.git
synced 2026-10-30 15:04:44 +00:00
Modules declare go 1.27.1 and the build images follow. go fix applied the modernizers; omitzero is not applied, since it changes what the JSON says. Co-authored-by: Hanzo Dev <[email protected]>
35 lines
840 B
Go
35 lines
840 B
Go
package binder
|
|
|
|
import "github.com/yuin/gopher-lua"
|
|
|
|
// Argument is a call function argument
|
|
type Argument struct {
|
|
state *lua.LState
|
|
number int
|
|
}
|
|
|
|
// String checks if function argument is string and return it
|
|
func (a *Argument) String() string {
|
|
return a.state.CheckString(a.number)
|
|
}
|
|
|
|
// Number checks if function argument is number (float64) and return it
|
|
func (a *Argument) Number() float64 {
|
|
return float64(a.state.CheckNumber(a.number))
|
|
}
|
|
|
|
// Bool checks if function argument is bool and return it
|
|
func (a *Argument) Bool() bool {
|
|
return a.state.CheckBool(a.number)
|
|
}
|
|
|
|
// Any returns function argument as interface{}
|
|
func (a *Argument) Any() any {
|
|
return a.state.CheckAny(a.number)
|
|
}
|
|
|
|
// Data checks if function argument is UserData and return it
|
|
func (a *Argument) Data() any {
|
|
return a.state.CheckUserData(a.number).Value
|
|
}
|