mirror of
https://github.com/Hilbis/Hilbish
synced 2025-07-14 14:52:02 +00:00
future plans: add the ability to use c lua (or luajit) with hilbish benefits? speed, i guess?
22 lines
503 B
Go
22 lines
503 B
Go
package util
|
|
|
|
import (
|
|
"hilbish/moonlight"
|
|
|
|
rt "github.com/arnodel/golua/runtime"
|
|
)
|
|
|
|
// LuaExport represents a Go function which can be exported to Lua.
|
|
type LuaExport struct {
|
|
Function moonlight.GoFunctionFunc
|
|
ArgNum int
|
|
Variadic bool
|
|
}
|
|
|
|
// SetExports puts the Lua function exports in the table.
|
|
func SetExports(rtm *rt.Runtime, tbl *rt.Table, exports map[string]LuaExport) {
|
|
for name, export := range exports {
|
|
rtm.SetEnvGoFunc(tbl, name, export.Function, export.ArgNum, export.Variadic)
|
|
}
|
|
}
|