Last active
March 24, 2023 17:04
-
-
Save Zbizu/b8ae694995d3753f2fc1aa1ecc27ddb5 to your computer and use it in GitHub Desktop.
Lua get a vector of integers for C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void LuaScriptInterface::getIntVector(lua_State* L, int32_t arg, std::vector<uint32_t>& vec) | |
{ | |
lua_pushnil(L); | |
while (lua_next(L, arg) != 0) { | |
if (lua_isnumber(L, -1)) { | |
vec.push_back(lua_tointeger(L, -1)); | |
} | |
lua_pop(L, 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment