lua/wrappers/gfx/lua_asset.cpp
/**
	 * Sets the number of frames the asset has in the x and y directions.
	 * These frames are in relation to the assets texture window.
	 *
	 * @param integer frame_x The number of x frames.
	 * @param integer frame_y The number of y frames.
	 * @param boolean [true] calc_total_frames When true the total texture windows will
	 *  be calculated as frame_x * frame_y.
	 * @returns am.asset This
	 */
Sets the number of frames the asset has in the x and y directions.
These frames are in relation to the assets texture window.

@param integer frame_x The number of x frames.
@param integer frame_y The number of y frames.
@param boolean [true] calc_total_frames When true the total texture windows will
be calculated as frame_x * frame_y.
Sets the number of frames the asset has in the x and y directions . These frames are in relation to the assets texture window . @param integer frame_x The number of x frames . @param integer frame_y The number of y frames . @param boolean [ true ] calc_total_frames When true the total texture windows will be calculated as frame_x * frame_y .
int Asset_num_frames(lua_State *lua)
	{
		Asset *asset = castUData<Asset>(lua, 1);
		if (asset)
		{
			int args = lua_gettop(lua);
			if (args == 1)
			{
				lua_pushinteger(lua, asset->getNumFramesX());
				lua_pushinteger(lua, asset->getNumFramesY());
				return 2;
			}
			else if (lua_isnum(lua, 2) && (args == 2 || (args == 3 && lua_isnum(lua, 3))))
			{
				asset->setNumFramesX(lua_tointeger(lua, 2));
				if (args == 3)
				{
					asset->setNumFramesY(lua_tointeger(lua, 3));
				}
				if (args < 4 || (args >= 4 && lua_isbool(lua, 4)))
				{
					asset->setTotalSubWindows(asset->getNumFramesX() * asset->getNumFramesY());
				}
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "num_frames", 2, "integer frames_x", "integer frames_x, integer frames_y");
		}
		return LuaState::expectedContext(lua, "num_frames", "am.asset");
	}
int Asset_num_frames ( lua_State * lua ) { Asset * asset = castUData < Asset > ( lua , 1 ) ; if ( asset ) { int args = lua_gettop ( lua ) ; if ( args == 1 ) { lua_pushinteger ( lua , asset -> getNumFramesX ( ) ) ; lua_pushinteger ( lua , asset -> getNumFramesY ( ) ) ; return 2 ; } else if ( lua_isnum ( lua , 2 ) && ( args == 2 || ( args == 3 && lua_isnum ( lua , 3 ) ) ) ) { asset -> setNumFramesX ( lua_tointeger ( lua , 2 ) ) ; if ( args == 3 ) { asset -> setNumFramesY ( lua_tointeger ( lua , 3 ) ) ; } if ( args < 4 || ( args >= 4 && lua_isbool ( lua , 4 ) ) ) { asset -> setTotalSubWindows ( asset -> getNumFramesX ( ) * asset -> getNumFramesY ( ) ) ; } lua_first ( lua ) ; } return LuaState :: expectedArgs ( lua , " " , 2 , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the number of frames the asset has in the x and y directions.
Sets the number of frames the asset has in the x and y directions .