Engine/Scripting/LuaBind.cpp
vec2 luaL_checkvec2(lua_State* L, int narg)
{
	if (!lua_istable(L, narg))
	{
		luaL_argerror(L, narg, "must pass a vector table (not a table)");
	}
	float x, y;
	lua_getfield(L, narg, "x");
	if (!lua_isnumber(L, -1))
	{
		luaL_argerror(L, narg, "must pass a vector table (bad x value)");
	}
	x = lua_tonumber(L, -1);
	lua_getfield(L, narg, "y");
	if (!lua_isnumber(L, -1))
	{
		luaL_argerror(L, narg, "must pass a vector table (bad y value)");
	}
	y = lua_tonumber(L, -1);
	lua_pop(L, 2);
	return vec2(x, y);
}
/**
 * Checks the given vector for validity (that it is a table with x and y values)
 * @param L A pointer to the lua_State containing the Lua stack.
 * @param narg The argument number of the pointer on the L stack that you would
 * like to check for validity.
 * @return A vec2 of the vector at narg, if it is valid.
 */
Checks the given vector for validity (that it is a table with x and y values)
@param L A pointer to the lua_State containing the Lua stack.
@param narg The argument number of the pointer on the L stack that you would
like to check for validity.
@return A vec2 of the vector at narg, if it is valid.
Checks the given vector for validity ( that it is a table with x and y values ) @param L A pointer to the lua_State containing the Lua stack . @param narg The argument number of the pointer on the L stack that you would like to check for validity . @return A vec2 of the vector at narg if it is valid .
vec2 luaL_checkvec2(lua_State* L, int narg)
{
	if (!lua_istable(L, narg))
	{
		luaL_argerror(L, narg, "must pass a vector table (not a table)");
	}
	float x, y;
	lua_getfield(L, narg, "x");
	if (!lua_isnumber(L, -1))
	{
		luaL_argerror(L, narg, "must pass a vector table (bad x value)");
	}
	x = lua_tonumber(L, -1);
	lua_getfield(L, narg, "y");
	if (!lua_isnumber(L, -1))
	{
		luaL_argerror(L, narg, "must pass a vector table (bad y value)");
	}
	y = lua_tonumber(L, -1);
	lua_pop(L, 2);
	return vec2(x, y);
}
vec2 luaL_checkvec2 ( lua_State * L , int narg ) { if ( ! lua_istable ( L , narg ) ) { luaL_argerror ( L , narg , " " ) ; } float x , y ; lua_getfield ( L , narg , " " ) ; if ( ! lua_isnumber ( L , -1 ) ) { luaL_argerror ( L , narg , " " ) ; } x = lua_tonumber ( L , -1 ) ; lua_getfield ( L , narg , " " ) ; if ( ! lua_isnumber ( L , -1 ) ) { luaL_argerror ( L , narg , " " ) ; } y = lua_tonumber ( L , -1 ) ; lua_pop ( L , 2 ) ; return vec2 ( x , y ) ; }
Checks the given vector for validity (that it is a table with x and y values)
 @param L A pointer to the lua_State containing the Lua stack.
Checks the given vector for validity ( that it is a table with x and y values ) @param L A pointer to the lua_State containing the Lua stack .