lua/wrappers/game/lua_stat_modifier.cpp
/**
	 * Sets the stat modifier type.
	 * <br>This is the list of each modifier type:
	 * <ul>
	 * <li>= : Sets the stat to the given value. This mod is applied first.</li>
	 * <li>* : Multiplies the stat by the given value. This mod is applied second.</li>
	 * <li>+ : Adds the given value directly onto the stat, this value can be negative. This mod is applied third.</li>
	 * </ul>
	 *
	 * @param string type The new type for this modifier.
	 * @returns am.stat_modifier This
	 */
Sets the stat modifier type.
This is the list of each modifier type:

= : Sets the stat to the given value. This mod is applied first.
* : Multiplies the stat by the given value. This mod is applied second.
+ : Adds the given value directly onto the stat, this value can be negative. This mod is applied third.


@param string type The new type for this modifier.
Sets the stat modifier type . This is the list of each modifier type : = : Sets the stat to the given value . This mod is applied first . * : Multiplies the stat by the given value . This mod is applied second . + : Adds the given value directly onto the stat this value can be negative . This mod is applied third . @param string type The new type for this modifier .
int StatModifier_type(lua_State *lua)
	{
		StatModifier *mod = castUData<StatModifier>(lua, 1);
		if (mod)
		{
			if (lua_gettop(lua) == 1)
			{
				lua_pushstring(lua, StatModifier::getModifierTypeString(mod->getType()));
				return 1;
			}
			else if (lua_isstr(lua, 2))
			{
				StatModifierType type = getStatModifier(lua, 2);
				if (type != MOD_MAX_LENGTH)
				{
					mod->setType(type);
				}
				else
				{
					std::stringstream ss;
					ss << "Invalid stat modifier type (";
					LuaState::printTypeValue(lua, 2, ss);
					ss << ')';
					LuaState::warning(lua, ss.str().c_str());
				}
				lua_first(lua);
			}
			return LuaState::expectedArgs(lua, "type", "string type");
		}
		return LuaState::expectedContext(lua, "type", "am.stat_modifier");
	}
int StatModifier_type ( lua_State * lua ) { StatModifier * mod = castUData < StatModifier > ( lua , 1 ) ; if ( mod ) { if ( lua_gettop ( lua ) == 1 ) { lua_pushstring ( lua , StatModifier :: getModifierTypeString ( mod -> getType ( ) ) ) ; return 1 ; } else if ( lua_isstr ( lua , 2 ) ) { StatModifierType type = getStatModifier ( lua , 2 ) ; if ( type != MOD_MAX_LENGTH ) { mod -> setType ( type ) ; } else { 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 stat modifier type.
Sets the stat modifier type .