EgtMachKernel :
- aggiunta funzione lua EmtSetLastError per segnalare errori nel PostProc - migliorie a simulazione con introduzione stato di movimento STOP.
This commit is contained in:
@@ -108,6 +108,8 @@ Machine::LuaInit( const string& sMachineName)
|
||||
m_LuaMgr.RegisterFunction( "EmtWrite", Machine::LuaEmtWrite) ;
|
||||
// registro la funzione per impostare informazioni di outstroke
|
||||
m_LuaMgr.RegisterFunction( "EmtSetOutstrokeInfo", Machine::LuaEmtSetOutstrokeInfo) ;
|
||||
// registro la funzione per impostare informazioni di errore
|
||||
m_LuaMgr.RegisterFunction( "EmtSetLastError", Machine::LuaEmtSetLastError) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -967,3 +969,22 @@ Machine::LuaEmtSetOutstrokeInfo( lua_State* L)
|
||||
LuaSetParam( L, true) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
Machine::LuaEmtSetLastError( lua_State* L)
|
||||
{
|
||||
// 2 parametri : nErrId, sErrDesc
|
||||
int nErrId ;
|
||||
LuaCheckParam( L, 1, nErrId)
|
||||
string sErrDesc ;
|
||||
LuaCheckParam( L, 2, sErrDesc)
|
||||
LuaClearStack( L) ;
|
||||
// verifico ci sia una macchina attiva
|
||||
if ( m_pMchLua == nullptr)
|
||||
return luaL_error( L, " Unknown Machine") ;
|
||||
// assegno i dati
|
||||
bool bOk = ( m_pMchLua->m_pMchMgr != nullptr && m_pMchLua->m_pMchMgr->SetLastError( nErrId, sErrDesc)) ;
|
||||
string sOut = "(" + ToString( nErrId) + ") " + sErrDesc ;
|
||||
return luaL_error( L, sOut.c_str()) ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user