-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CMatrix 4x4 lua table in ArgumentParser #3849
base: master
Are you sure you want to change the base?
Conversation
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex) | ||
{ | ||
uint uiRow = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::uint32_t
instead of uint
|
||
if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE) | ||
{ | ||
for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is that weird for loop? you can initialize uiRow
(btw dont use hungarian notation) in the loop directly if needed
@@ -584,6 +584,7 @@ class CScriptArgReader; | |||
void MixedReadDxFontString(CScriptArgReader& argStream, eFontType& outFontType, eFontType defaultFontType, CClientDxFont*& poutDxFontElement); | |||
void MixedReadGuiFontString(CScriptArgReader& argStream, SString& strFontName, const char* szDefaultFontName, CClientGuiFont*& poutGuiFontElement); | |||
void MixedReadMaterialString(CScriptArgReader& argStream, CClientMaterial*& pMaterialElement); | |||
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noexcept
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex) | ||
{ | ||
uint uiRow = 0; | ||
uint uiCell = 0; | ||
|
||
if (lua_type(luaVM, uiArgIndex) == LUA_TTABLE) | ||
{ | ||
for (lua_pushnil(luaVM); lua_next(luaVM, uiArgIndex) != 0; lua_pop(luaVM, 1), uiRow++) | ||
{ | ||
if (lua_type(luaVM, -1) != LUA_TTABLE) | ||
return false; | ||
|
||
uint uiCol = 0; | ||
|
||
for (lua_pushnil(luaVM); lua_next(luaVM, -2) != 0; lua_pop(luaVM, 1), uiCol++, uiCell++) | ||
{ | ||
int iArgumentType = lua_type(luaVM, -1); | ||
if (iArgumentType != LUA_TNUMBER && iArgumentType != LUA_TSTRING) | ||
return false; | ||
} | ||
|
||
if (uiCol != 4) | ||
return false; | ||
} | ||
} | ||
|
||
if (uiRow != 4 || uiCell != 16) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above
@@ -389,6 +389,7 @@ void MixedReadResourceString(CScriptArgReader& argStream, CResource*& pOutRes | |||
bool StringToBool(const SString& strText); | |||
void MinServerReqCheck(CScriptArgReader& argStream, const char* szVersionReq, const char* szReason); | |||
void ReadPregFlags(CScriptArgReader& argStream, pcrecpp::RE_Options& pOptions); | |||
bool IsValidMatrixLuaTable(lua_State* luaVM, uint uiArgIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noexcept
weź tracer nie wkurwiaj ludzi i zamknij ten pysk dzięki |
This PR adds for ArgumentParser to accept a 4x4 lua table as a CMatrix.