Advertisement
Hendrix000007

3Claws debug module (in progress)

May 4th, 2017
524
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. --[[
  2. DEBUG MODULE/CLASS FOR TERMINAL OUTPUT
  3. WHEN DEALING WITH SUBTILE BUGS AND SHIT.
  4.  
  5. FREE TO USE FOR ANYONE
  6. HENDRIX © 3 CLAWS GAMES
  7. --]]
  8.  
  9. -- VARIABLES --------------------------
  10. _G.debugMode = 0
  11.  
  12. -- PUT THIS CHUNK WHERE YOU LIKE IN ANY PART OF YOUR CODE AND CLASSES, IT IS VISIBLE EVERYWHERE ---
  13. if _G.debugMode == 1 then
  14.     -- do shit like i.e. audio.setVolume = 0 if you like to listen to Spotify when coding
  15.     -- and you are sick tired of the game sound when debuging :)
  16. else
  17.     --do default shit
  18. end
  19.  
  20.  
  21.  
  22.  
  23. -- FUNCTIONS ---- ( ALL FUNCTIONS ARE GLOBAL AND VISIBLE TO ALL SCOPES IN THE PROJECT ) ------------
  24. function printClasses()
  25.     print("@@@@@@@@@@@@@@@@@@CLASSES@@@@@@@@@@@@@@@@@@@")
  26.     for k,v in pairs(_G.package.loaded) do
  27.         print(k,v)
  28.     end
  29.     print("@@@@@@@@@@@@@@@@@@CLASSES@@@@@@@@@@@@@@@@@@@")
  30. end
  31.  
  32. function deleteClass(class)
  33.     if package.loaded[class] then
  34.         package.loaded[class] = nil
  35.         print("**** Removed class: " .. class, " ******")
  36.     end
  37. end
  38.  
  39. function henDebuggerFunc(param, delete)
  40.     local delete = _G.paramDelete
  41.     print("\n*************************\n*** DEBUGGER FUNCTION ***\n*************************")
  42.     print("\n\n***Checking for Runtime objects***")
  43.    
  44.     if _G.henDebugger == true then              --If the debugger is turned on
  45.        
  46.         for k, v in pairs(_G.display) do        -- First we check for critical non deleted RuntimeObjects
  47.             print( "•• Media lib   " .. k, v )
  48.         end
  49.  
  50.         if nil ~= param then                    -- If there is an Object(param in ths case)...
  51.             print("\n***Checking for user inputs of objects")
  52.             print( "ParamType is ", param.type ) -- We first just print out the Object type
  53.         end
  54.         if nil ~= param and delete == true then -- Set this to true if you like to delete the objects ...default is false
  55.                 param:removeSelf()
  56.                 param = nil
  57.                 print( param, "removed" )
  58.             else
  59.                 print( param, "\n***The user object is not present" )
  60.  
  61.         --  return _G.paramDelete               -- Returning the value of paramDelete for next time
  62.         end
  63.         print("\n*************************\n*** DEBUGGER END ***\n*************************")
  64.     end
  65.     return true
  66. end
  67.  
  68. --[[
  69. -- FOR LISTING THE FONTS AVAILABLE TO USE IN PROJECTS AND GETTING THE 'RIGHT' NAMES
  70. local sysFonts = native.getFontNames()
  71. for k,v in pairs(sysFonts) do print(v) end
  72. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement