feat(ui): implement Script_GetCVar
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run

This commit is contained in:
fallenoak 2026-01-29 12:46:31 -06:00
parent 0bb3ac157f
commit 26522016e0
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -133,7 +133,21 @@ int32_t Script_SetCVar(lua_State* L) {
}
int32_t Script_GetCVar(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
if (!lua_isstring(L, 1)) {
luaL_error(L, "Usage: GetCVar(\"cvar\")");
return 0;
}
auto varName = lua_tostring(L, 1);
auto var = CVar::LookupRegistered(varName);
if (var && !(var->m_flags & 0x40)) {
lua_pushstring(L, var->GetString());
} else {
lua_pushnil(L);
}
return 1;
}
int32_t Script_GetCVarBool(lua_State* L) {