EgtExecutor 1.8l2 :
- aggiunte a Exe e Lua funzioni ExecTscLine, SetTscVar e GetTscVar.
This commit is contained in:
@@ -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) ;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -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) ;
|
||||
|
||||
Reference in New Issue
Block a user