Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //New version that's simpler: http://pastebin.com/38jjPhnx
- class 'UnitTestManager' (GUIScript)
- local this
- function UnitTestManager:Initialize()
- this = self
- self.tests = {}
- end
- function UnitTestManager:Uninitialize()
- self.tests = nil
- end
- function UnitTestManager:RunTests()
- //no trouble using self now when hooked to a console event.
- for i,v in pairs(self.tests) do
- end
- end
- //global so it can be called in different test files without having to recreate this line:
- UnitTestManager = GetGUIManager():CreateGUIScriptSingle("UnitTestManager")
- if not UnitTestManager_Hooked then //wrapped in if so that saving changes to this file won't cause additional hooks
- UnitTestManager_Hooked = true
- local function Test()
- UnitTestManager.RunTests(this) //this = self of the instance.
- end
- Event.Hook("Console_test", Test)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement