2024-07-21 15:37:08 +00:00
|
|
|
//go:build !midnight
|
2024-07-19 20:54:15 +00:00
|
|
|
package moonlight
|
|
|
|
|
|
|
|
import (
|
|
|
|
rt "github.com/arnodel/golua/runtime"
|
|
|
|
)
|
|
|
|
|
|
|
|
type GoFunctionFunc = rt.GoFunctionFunc
|
|
|
|
|
|
|
|
func (mlr *Runtime) CheckNArgs(c *GoCont, num int) error {
|
2024-07-20 15:34:39 +00:00
|
|
|
return c.cont.CheckNArgs(num)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mlr *Runtime) Check1Arg(c *GoCont) error {
|
|
|
|
return c.cont.CheckNArgs(1)
|
2024-07-19 20:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (mlr *Runtime) StringArg(c *GoCont, num int) (string, error) {
|
2024-07-20 15:34:39 +00:00
|
|
|
return c.cont.StringArg(num)
|
2024-07-19 20:54:15 +00:00
|
|
|
}
|
|
|
|
|
2024-07-20 15:46:07 +00:00
|
|
|
func (mlr *Runtime) ClosureArg(c *GoCont, num int) (*Closure, error) {
|
|
|
|
return c.cont.ClosureArg(num)
|
|
|
|
}
|
|
|
|
|
2024-07-20 18:49:43 +00:00
|
|
|
func (mlr *Runtime) Arg(c *GoCont, num int) Value {
|
|
|
|
return c.cont.Arg(num)
|
|
|
|
}
|
|
|
|
|
2024-07-21 15:37:08 +00:00
|
|
|
func (mlr *Runtime) GoFunction(fun GoToLuaFunc) GoFunctionFunc {
|
2024-07-19 20:54:15 +00:00
|
|
|
return func(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
2024-07-20 15:34:39 +00:00
|
|
|
gocont := GoCont{
|
|
|
|
cont: c,
|
|
|
|
thread: t,
|
|
|
|
}
|
2024-07-19 20:54:15 +00:00
|
|
|
return fun(mlr, &gocont)
|
|
|
|
}
|
|
|
|
}
|