lua/wrappers/game/lua_stats.cpp
/**
	 * Sets the base value of the given stat with the given value.
	 *
	 * @param string stat_name The name of the stat to set the base value of.
	 * @param number base_value The new base value for the stat.
	 * @returns am.stats This
	 */
Sets the base value of the given stat with the given value.
@param string stat_name The name of the stat to set the base value of.
@param number base_value The new base value for the stat.
Sets the base value of the given stat with the given value . @param string stat_name The name of the stat to set the base value of . @param number base_value The new base value for the stat .
int Stats_base_stat(lua_State *lua)
	{
		Stats *stats = castUData<Stats>(lua, 1);
		if (stats)
		{
			if (lua_isstr(lua, 2) || lua_isnum(lua, 2)) {
				Stat::StatType stat = getStat(lua, 2);
				if (stat != Stat::MAX_STAT_LENGTH)
				{
					if (lua_gettop(lua) == 2)
					{
						lua_pushnumber(lua, stats->getBaseStat(stat));
						return 1;
					}
					else if (lua_isnum(lua, 3))
					{
						float value = lua_tofloat(lua, 3);
						stats->setBaseStat(stat, value);
						lua_first(lua);
					}
				}
				std::stringstream ss;
				ss << "Invalid stat name (";
				LuaState::printTypeValue(lua, 2, ss);
				ss << ") for am.stats.base_value";
				LuaState::warning(lua, ss.str().c_str());
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "base_stat", "string stat_name, number base_value");
		}
		return LuaState::expectedContext(lua, "base_stat", "am.stats");
	}
int Stats_base_stat ( lua_State * lua ) { Stats * stats = castUData < Stats > ( lua , 1 ) ; if ( stats ) { if ( lua_isstr ( lua , 2 ) || lua_isnum ( lua , 2 ) ) { Stat :: StatType stat = getStat ( lua , 2 ) ; if ( stat != Stat :: MAX_STAT_LENGTH ) { if ( lua_gettop ( lua ) == 2 ) { lua_pushnumber ( lua , stats -> getBaseStat ( stat ) ) ; return 1 ; } else if ( lua_isnum ( lua , 3 ) ) { float value = lua_tofloat ( lua , 3 ) ; stats -> setBaseStat ( stat , value ) ; lua_first ( lua ) ; } } std :: stringstream ss ; ss << " " ; LuaState :: printTypeValue ( lua , 2 , ss ) ; ss << " " ; LuaState :: warning ( lua , ss . str ( ) . c_str ( ) ) ; lua_first ( lua ) ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Sets the base value of the given stat with the given value.
Sets the base value of the given stat with the given value .