Open tabularelf opened 1 month ago
OK... and I am just spitballing here... how about an interface like
commands = {
"name-to-type": { func: funcToCall, help: "Help text", args: [
{ name: "my-first-argument", type: "real", help: "Help Text for argument" },
{ name: "my-second-argument", type: "string", help: "Help Text for second argument" } ] }
}
var refCmd = ref_create( self, "commands" );
debug_console_commands( refCmd );
Then the commands can be added to and changed easily at a code level and once this is used it would supercede any earlier call (and no other commands would work... except for help
)
Ooo! Actually I like that a lot! I like that a lot!
help
being thrown in here is a nice treat, I'll take it haha
commands = {
"spawn": {
func: function(_x, _y, _obj) {
// Obviously this needs more error checks in this case, but just as a proof of concept
instance_create_layer(_x, _y, "Instances", asset_get_index(_obj));
},
args: [
{ name: "x", type: "real", help: "X coordinate to spawn" },
{ name: "y", type: "real", help: "Y coordinate to spawn" }
{ name: "object", type: "string", help: "Object to spawn" }
]
}
}
var refCmd = ref_create( self, "commands" );
debug_console_commands( refCmd );
Yeah, I think this could work nicely
this is a lot like what I used to do for debug consoles before the imgui debug console was added
even if the debug console was never enabled in release builds, this could be useful if you ever wanted functions to work slightly differently to when it does when called by the runtime
Is your feature request related to a problem?
I actually like the Imgui console, but it's rather bothersome that there's no clear way of choose what is allowed and what's not allowed. It'd be really nice if we could whitelist certain functions to be used with the debug console. So that way the developer can restrict certain functions from being exposed.
Describe the solution you'd like
Preferably some kind of function, such as
debug_log_add_whitelist(functionId)
ordebug_log_add_command(name_of_command, function)
, to allow only certain functions in.Describe alternatives you've considered
Not allowing the debug overlay to be used at all outside of dev builds. Building a custom console
Additional context
No response