Make and use a vector variant of luax_convobj

Which also prevents accessing the zeroeth element of an empty vector
This commit is contained in:
Bart van Strien
2018-12-03 18:19:28 +01:00
parent a1d6da4624
commit 7253118100
3 changed files with 20 additions and 6 deletions
+4 -2
View File
@@ -389,11 +389,13 @@ int luax_convobj(lua_State *L, int idx, const char *module, const char *function
* @param module The module in the love table.
* @param function The function in the module.
**/
int luax_convobj(lua_State *L, int idxs[], int n, const char *module, const char *function);
int luax_convobj(lua_State *L, const int idxs[], int n, const char *module, const char *function);
int luax_convobj(lua_State *L, const std::vector<int>& idxs, const char *module, const char *function);
// pcall versions of the above
int luax_pconvobj(lua_State *L, int idx, const char *module, const char *function);
int luax_pconvobj(lua_State *L, int idxs[], int n, const char *module, const char *function);
int luax_pconvobj(lua_State *L, const int idxs[], int n, const char *module, const char *function);
int luax_pconvobj(lua_State *L, const std::vector<int>& idxs, const char *module, const char *function);
/**
* 'Insist' that a table 'k' exists in the table at idx. Insistence involves that the