Advertisement
FocusedWolf

Detecting Code Reload

Aug 9th, 2011
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. class 'GUITestBed' (GUIScript)
  2.  
  3. /*
  4.     The result of this code is any saved changes to GUITestBed.lua will be detected resulting in this console output:
  5.  
  6.     <<<<< GUITestBed:Uninitialize()
  7.     >>>>> GUITestBed:Initialize()
  8. */
  9.  
  10. local initializeCalled = false
  11.  
  12. function GUITestBed:Initialize()
  13.  
  14.     initializeCalled = true
  15.  
  16.     Print(">>>>> GUITestBed:Initialize()")
  17.  
  18. end
  19.  
  20. function GUITestBed:Uninitialize()
  21.  
  22.     Print("<<<<< GUITestBed:Uninitialize()")
  23.  
  24. end
  25.  
  26. function GUITestBed:OnCodeReload()
  27.  
  28.    self:Uninitialize()
  29.    self:Initialize()
  30.  
  31. end
  32.  
  33. function GUITestBed:Update(deltaTime)
  34.  
  35.     if not initializeCalled then
  36.         self:OnCodeReload()
  37.     end
  38.  
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement