EgtExecutor 1.8l2 :

- aggiunte a Exe e Lua funzioni ExecTscLine, SetTscVar e GetTscVar.
This commit is contained in:
Dario Sassi
2017-12-12 07:34:08 +00:00
parent 026e9f5202
commit 1f1c589f47
3 changed files with 77 additions and 0 deletions
+23
View File
@@ -103,3 +103,26 @@ ExeTscExecLine( const string& sLine)
// eseguo il comando
return pTscExec->ExecLine( sLine) ;
}
//-----------------------------------------------------------------------------
bool
ExeTscSetVariable( const string& sName, int nVal)
{
ICmdParser* pTscExec = GetCurrTscExecutor() ;
VERIFY_TSCEXEC( pTscExec, false)
// eseguo il comando
if ( pTscExec->SetVariable( sName, nVal))
return true ;
else
return pTscExec->AddVariable( sName, nVal) ;
}
//-----------------------------------------------------------------------------
bool
ExeTscGetVariable( const string& sName, int& nVal)
{
ICmdParser* pTscExec = GetCurrTscExecutor() ;
VERIFY_TSCEXEC( pTscExec, false)
// eseguo il comando
return pTscExec->GetVariable( sName, nVal) ;
}
BIN
View File
Binary file not shown.
+54
View File
@@ -202,6 +202,57 @@ LuaExecTsc( lua_State* L)
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaExecTscLine( lua_State* L)
{
// 1 parametro : linea
string sLine ;
LuaCheckParam( L, 1, sLine)
LuaClearStack( L) ;
// eseguo la linea TSC
bool bOk = ExeTscExecLine( sLine) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaSetTscVar( lua_State* L)
{
// 2 parametri : nome, valore
string sName ;
LuaCheckParam( L, 1, sName)
int nVal ;
LuaCheckParam( L, 2, nVal)
LuaClearStack( L) ;
// assegno il valore alla variabile Tsc
bool bOk = ExeTscSetVariable( sName, nVal) ;
// restituisco il risultato
LuaSetParam( L, bOk) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaGetTscVar( lua_State* L)
{
// 1 parametro : nome
string sName ;
LuaCheckParam( L, 1, sName)
LuaClearStack( L) ;
// recupero il valore della variabile Tsc
int nVal ;
bool bOk = ExeTscGetVariable( sName, nVal) ;
// restituisco il risultato
if ( bOk)
LuaSetParam( L, nVal) ;
else
LuaSetParam( L) ;
return 1 ;
}
//-------------------------------------------------------------------------------
static int
LuaOutLog( lua_State* L)
@@ -647,6 +698,9 @@ LuaInstallGeneral( LuaMgr& luaMgr)
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitString", LuaSplitString) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitStringPlus", LuaSplitStringPlus) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExecTsc", LuaExecTsc) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtExecTscLine", LuaExecTscLine) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtSetTscVar", LuaSetTscVar) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtGetTscVar", LuaGetTscVar) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOutLog", LuaOutLog) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtOutBox", LuaOutBox) ;
bOk = bOk && luaMgr.RegisterFunction( "EgtProcessEvents", LuaProcessEvents) ;