27 lines
772 B
C
27 lines
772 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "console/console.h"
|
|
|
|
void cmdSet(const consolecmdexec_t *exec) {
|
|
assertTrue(exec->argc >= 2, "set command requires 2 arguments.");
|
|
|
|
for(uint32_t i = 0; i < CONSOLE.variableCount; i++) {
|
|
consolevar_t *var = &CONSOLE.variables[i];
|
|
if(stringCompare(var->name, exec->argv[0]) != 0) continue;
|
|
consoleVarSetValue(var, exec->argv[1]);
|
|
consolePrint("%s %s", var->name, var->value);
|
|
for(i = 0; i < var->eventCount; i++) {
|
|
assertNotNull(var->events[i], "Event is NULL");
|
|
var->events[i](var);
|
|
}
|
|
return;
|
|
}
|
|
|
|
consolePrint("Error: Variable '%s' not found.", exec->argv[0]);
|
|
} |