From 3ae999c98b44f2b731ede6366d870d88691fff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20=C3=85hall?= Date: Fri, 9 May 2025 07:28:12 +0200 Subject: [PATCH] Added JSON response of LUA variable --- pkg.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg.go b/pkg.go index c002e76..1d7f67d 100644 --- a/pkg.go +++ b/pkg.go @@ -38,6 +38,12 @@ func (l *LUA) GetStructFromLUA(ltable gopherLua.LValue, strct any) (err error) { return } +func (l *LUA) GetJSONromLUA(ltable gopherLua.LValue) (j []byte) { + j, _ = luaJSON.Encode(ltable) + return +} + + func (l *LUA) Run(script string) (err error) { return l.state.DoString(script) }