Files
effector.plugin.fivelakes/Supervisor.Plugin.FiveLakes/LUA/Lua_General.vb
T
Emmanuele Sassi 7f031691bb - aggiunti backup dir e resources dir
- aggiunti flag di debug per nascondere grafica di debug
- aggiunti bottoni per verificare porte e resettare coda di produzione
- aggiunto stato di produzione e tempi a lista porte
- aggiunto stato lua a plugin
- aggiunta gestione tabella di tabella in alcune funzioni lua
- aggiunte funzioni che gestiscono esecuzione sincrona ed asincrona dell' eseguibile
- migliorato mainmenu ora funzionante
- aggiunta pagina statistiche
- aggiunto in pagina macchina disegno macchina con variabili di debug e lista circolare porte
2024-09-03 11:19:57 +02:00

73 lines
2.4 KiB
VB.net

Imports KeraLua
Public Module Lua_General
Friend func_PlgExecProcess As LuaFunction = AddressOf Lua_PlgExecProcess
Friend func_PlgExecProcessAsync As LuaFunction = AddressOf Lua_PlgExecProcessAsync
Friend func_PlgCheckExecProcessAsync As LuaFunction = AddressOf Lua_PlgCheckExecProcessAsync
Friend func_PlgGetNextDoor As LuaFunction = AddressOf Lua_PlgGetNextDoor
Private Function Lua_PlgExecProcess(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sDDFName As String = ""
LuaCheckParam(state, 1, sDDFName)
LuaClearStack(state)
If Map.refDoorListPageVM.ExecCAMProcess(sDDFName) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_PlgExecProcessAsync(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
Dim sDDFName As String = ""
LuaCheckParam(state, 1, sDDFName)
LuaClearStack(state)
If Map.refDoorListPageVM.ExecCAMProcessAsync(sDDFName) Then
state.PushBoolean(True)
Return 1
Else
Return 0
End If
End Function
Private Function Lua_PlgCheckExecProcessAsync(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
LuaClearStack(state)
Dim bHasExited As Boolean = False
Dim nExitCode As Integer = -1
If Map.refSupervisorFunction.PlgCheckExecProcessAsync(bHasExited, nExitCode) Then
state.PushBoolean(bHasExited)
state.PushInteger(nExitCode)
Return 2
Else
Return 0
End If
End Function
Private Function Lua_PlgGetNextDoor(ByVal p As IntPtr) As Integer
Dim state = Lua.FromIntPtr(p)
LuaClearStack(state)
Dim NextDoor As Door = Map.refDoorListPageVM.GetNextDoor()
If Not IsNothing(NextDoor) Then
' restituisco il risultato
LuaSetParam(state, NextDoor.nId)
LuaSetParam(state, NextDoor.sDDFName)
Return 2
End If
Return 0
End Function
Friend Function LuaInstallGeneral(state As Lua) As Boolean
If IsNothing(state) Then Return False
state.Register("PlgExecProcess", func_PlgExecProcess)
state.Register("PlgExecProcessAsync", func_PlgExecProcessAsync)
state.Register("PlgCheckExecProcessAsync", func_PlgCheckExecProcessAsync)
state.Register("PlgGetNextDoor", func_PlgGetNextDoor)
Return True
End Function
End Module