So I’ve got this little conundrum that I’m sure can easily be solved by someone more skilled in the art of Lua than myself.
In the file garrysmod/lua/includes/modules/timer.lua garry defines the functions for everything timer related. Inside that file, he creates a local table, called ‘Timer’. I’d like to be able to actually read that table, but I keep getting confundled. I’ve tried the following (please don’t laugh at me):
note: this code is all within timer.lua
function All() return Timer end
Trying to run this function either as timer.All() or simply All() returns an undefined function.
PrintTable( Timer )
inside the file just to print it to my console, but it gives me this error:
Unhandled Lua Refresh: [NAME:includes/modules/timer.lua] [TYPE:]
if I restart my game with the code still there, it simply does not print the table.
The last thing I’ve tried is modifying the timer.Create function to MsgN the timer name, like this:
function Create( name, delay, reps, func, a, b, c ) if ( !isfunction( func ) || a != nil || b != nil || c != nil || !isnumber( delay ) || !isnumber( reps ) ) then error( "timer.Create - called wrong! " ) return end MsgN( name ) if ( Exists( name ) ) then Destroy( name ) end Adjust( name, delay, reps, func ) Start( name ) local timerObj = TIMER_CLASS.New() timerObj.name = name return timerObj; end
That doesn’t MsgN anything. I’m confused. Help?