Replace getCanvas/ImageFormats with getTextureFormats

This commit is contained in:
Alex Szpakowski
2020-02-12 22:25:04 -04:00
parent f5f7e908a9
commit 5c06b2a860
4 changed files with 75 additions and 3 deletions
+10
View File
@@ -45,6 +45,16 @@ struct Optional
value = val;
hasValue = true;
}
T get(T defaultVal)
{
return hasValue ? value : defaultVal;
}
void clear()
{
hasValue = false;
}
};
typedef Optional<bool> OptionalBool;
+18 -1
View File
@@ -300,6 +300,23 @@ double luax_numberflag(lua_State *L, int table_index, const char *key, double de
return retval;
}
bool luax_checkboolflag(lua_State *L, int table_index, const char *key)
{
lua_getfield(L, table_index, key);
bool retval = false;
if (lua_type(L, -1) != LUA_TBOOLEAN)
{
std::string err = "expected boolean field '" + std::string(key) + "' in table";
return luaL_argerror(L, table_index, err.c_str());
}
else
retval = luax_toboolean(L, -1);
lua_pop(L, 1);
return retval;
}
int luax_checkintflag(lua_State *L, int table_index, const char *key)
{
lua_getfield(L, table_index, key);
@@ -307,7 +324,7 @@ int luax_checkintflag(lua_State *L, int table_index, const char *key)
int retval;
if (!lua_isnumber(L, -1))
{
std::string err = "expected integer field " + std::string(key) + " in table";
std::string err = "expected integer field '" + std::string(key) + "' in table";
return luaL_argerror(L, table_index, err.c_str());
}
else
+1
View File
@@ -190,6 +190,7 @@ bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultV
int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValue);
double luax_numberflag(lua_State *L, int table_index, const char *key, double defaultValue);
bool luax_checkboolflag(lua_State *L, int table_index, const char *key);
int luax_checkintflag(lua_State *L, int table_index, const char *key);
/**