Skip to content

Commit

Permalink
return the status of the debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dwursteisen committed Dec 20, 2023
1 parent bf7e08c commit 3a090aa
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,23 @@ class DebugLib(private val resourceAccess: GameResourceAccess) : TwoArgFunction(

@TinyFunction("Enable or disable debug feature.", example = DEBUG_ENABLED_EXAMPLE)
internal inner class enabled : OneArgFunction() {

private var status = false

@TinyCall("Enable or disable debug by passing true to enable, false to disable.")
override fun call(@TinyArg("enabled") arg: LuaValue): LuaValue {
if (arg.isnil()) {
return valueOf(status)
}

val enabled = arg.optboolean(true)
status = enabled
resourceAccess.debug(DebugEnabled(enabled))
return NIL
return valueOf(status)
}

@TinyCall("Return true if debug is enabled. False otherwise.")
override fun call(): LuaValue = super.call()
}

@TinyFunction("Display a table.", example = DEBUG_EXAMPLE)
Expand Down

0 comments on commit 3a090aa

Please sign in to comment.