1010 *****************************************************************************/
1111
1212#include " StdInc.h"
13+ #include < lua/CLuaFunctionParser.h>
1314
1415void CLuaTimerDefs::LoadFunctions ()
1516{
1617 constexpr static const std::pair<const char *, lua_CFunction> functions[]{
17- {" setTimer" , SetTimer}, {" killTimer" , KillTimer}, {" resetTimer" , ResetTimer},
18- {" getTimers" , GetTimers}, {" isTimer" , IsTimer}, {" getTimerDetails" , GetTimerDetails},
18+ {" setTimer" , SetTimer}, {" killTimer" , KillTimer}, {" resetTimer" , ResetTimer},
19+ {" setTimerPaused" , ArgumentParser<SetTimerPaused>},{" isTimerPaused" , ArgumentParser<IsTimerPaused>},
20+ {" getTimers" , GetTimers}, {" isTimer" , IsTimer}, {" getTimerDetails" , GetTimerDetails},
1921 };
2022
2123 // Add functions
@@ -31,10 +33,10 @@ void CLuaTimerDefs::AddClass(lua_State* luaVM)
3133 lua_classfunction (luaVM, " destroy" , " killTimer" );
3234 lua_classfunction (luaVM, " reset" , " resetTimer" );
3335 lua_classfunction (luaVM, " isValid" , " isTimer" );
34-
3536 lua_classfunction (luaVM, " getDetails" , " getTimerDetails" );
3637
3738 lua_classvariable (luaVM, " valid" , NULL , " isTimer" );
39+ lua_classvariable (luaVM, " paused" , " setTimerPaused" , " isTimerPaused" );
3840
3941 lua_registerclass (luaVM, " Timer" );
4042}
@@ -111,6 +113,22 @@ int CLuaTimerDefs::KillTimer(lua_State* luaVM)
111113 return 1 ;
112114}
113115
116+ bool CLuaTimerDefs::IsTimerPaused (CLuaTimer* timer) noexcept
117+ {
118+ return timer->IsPaused ();
119+ }
120+
121+ bool CLuaTimerDefs::SetTimerPaused (lua_State* luaVM, CLuaTimer* timer, bool paused)
122+ {
123+ // bool setTimerPaused ( timer theTimer, bool paused )
124+ CLuaMain* luaMain = m_pLuaManager->GetVirtualMachine (luaVM);
125+ if (!luaMain)
126+ return false ;
127+
128+ luaMain->GetTimerManager ()->SetTimerPaused (timer, paused);
129+ return true ;
130+ }
131+
114132int CLuaTimerDefs::ResetTimer (lua_State* luaVM)
115133{
116134 // bool resetTimer ( timer theTimer )
0 commit comments