Compare commits

..

No commits in common. "main" and "v0.1.0" have entirely different histories.
main ... v0.1.0

2 changed files with 3 additions and 9 deletions

2
go.mod
View file

@ -1,4 +1,4 @@
module git.gibonuddevalla.se/go/lua
module lua
go 1.24.2

10
pkg.go
View file

@ -19,12 +19,12 @@ func NewLUA() (lua LUA) {
return
}
func (l *LUA) SetStructInLUA(varname string, strct any) (ltable gopherLua.LValue, err error) {
func (l *LUA) SetStructInLUA(L *gopherLua.LState, varname string, strct any) (ltable gopherLua.LValue, err error) {
// JSON is used as a communications layer.
j, _ := json.Marshal(strct)
// JSON is decoded to a Lua table.
ltable, err = luaJSON.Decode(l.state, j)
ltable, err = luaJSON.Decode(L, j)
if err != nil {
return
}
@ -38,12 +38,6 @@ func (l *LUA) GetStructFromLUA(ltable gopherLua.LValue, strct any) (err error) {
return
}
func (l *LUA) GetJSONFromLUA(ltable gopherLua.LValue) (j []byte) {
j, _ = luaJSON.Encode(ltable)
return
}
func (l *LUA) Run(script string) (err error) {
return l.state.DoString(script)
}