Fix possible segfault for cvars registered from lua with flag CV_CALL
(made same PR to "official" kart repository but it doesn't seem it would get merged any time soon)
So, the problem was that lua_next
doesn't guarantee order of keys when iterating through table, so sometimes CV_RegisterVar checks field func
before field flags
, doesn't add it because cvar doesn't have CV_CALL
flag, and at the end it has CV_CALL
flag but no valid func
, and then modifying this cvar causes game to crash.
Edited by Indev