Some decisions regarding the lua env

it will be in the app environment because it serves the app, will think
about it later
This commit is contained in:
2025-08-28 01:46:39 +01:00
parent 7320b61df7
commit 404b41ae75
29 changed files with 420 additions and 289 deletions
+21
View File
@@ -0,0 +1,21 @@
package expenses
import (
"expenses/luadec"
ljson "github.com/layeh/gopher-json"
lua "github.com/yuin/gopher-lua"
)
func (a *ExpensesApp) registerLuaBinds(L *lua.LState) {
ljson.Preload(L)
L.SetGlobal("GetAllExpenses", L.NewFunction(a.luaGetAllExpenses))
L.SetGlobal("AddDecimal", L.NewFunction(luadec.AddDecimal))
L.SetGlobal("NormalizeShare", L.NewFunction(a.luaNormalizeShares))
}
func returnWithError(L *lua.LState, strErr string) int {
L.Push(lua.LNil)
L.Push(lua.LString(strErr))
return 2
}