diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f16796..cde4cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add a gamesystem module +- **core/debug:** add log functions + ### Changed - **world:** extract map module from the world module diff --git a/gamecore/debug.lua b/gamecore/debug.lua index fe6076d..0c1097a 100644 --- a/gamecore/debug.lua +++ b/gamecore/debug.lua @@ -36,4 +36,26 @@ function DebugSystem:update(dt) lovebird.update(dt) end +-- PRINT FUNCTIONS +-- Print and log debug string + +function DebugSystem:print(context, string) + if (self.active) then + print("[DEBUG] ".. context .. ": " .. string) + end +end + +function DebugSystem:warning(context, string) + if (self.active) then + print("[WARNING] " .. context .. ": " .. string) + end +end + +function DebugSystem:error(context, string) + if (self.active) then + error("[ERROR] " .. context .. ": " .. string) + end +end + + return DebugSystem