Skip to content

Commit 4efc7ef

Browse files
author
L'In20Cible
committed
Added __int__, __float__, __str__ and __bool__ methods to ConVar.
1 parent 3391d92 commit 4efc7ef

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/core/modules/cvars/cvars_wrap.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,26 @@ void export_convar(scope _cvars)
281281
"Remove the notify flag and makes the cvar no longer public."
282282
)
283283

284+
// Special methods...
285+
.def("__float__",
286+
&ConVar::GetFloat,
287+
"Returns the value as a float."
288+
)
289+
290+
.def("__int__",
291+
&ConVar::GetInt,
292+
"Returns the value as an int."
293+
)
294+
295+
.def("__bool__",
296+
&ConVar::GetBool,
297+
"Returns the value as a bool."
298+
)
299+
300+
.def("__str__",
301+
&ConVar::GetString,
302+
"Returns the value as a string."
303+
)
284304

285305
ADD_MEM_TOOLS(ConVar)
286306
;

0 commit comments

Comments
 (0)