lua/wrappers/game/lua_item.cpp
/**
	 * @static
	 * Behaves the same as the base constructor however the new item will be created
	 * from the given item definition if it has to be created.
	 * 
	 * @param string [""] game_id The game id to create the item with or the game id of an existing item.
	 * @param string def_name The item definition name to look up when creating the item if it one did not exist.
	 * @returns am.item The newly created item or returns an existing item with the same game_id.
	 * @returns boolean True if the item was newly created or false if it already existed.
	 */
@static
Behaves the same as the base constructor however the new item will be created
from the given item definition if it has to be created.

@param string [""] game_id The game id to create the item with or the game id of an existing item.
@param string def_name The item definition name to look up when creating the item if it one did not exist.
@returns am.item The newly created item or returns an existing item with the same game_id.
@returns boolean True if the item was newly created or false if it already existed.
@static Behaves the same as the base constructor however the new item will be created from the given item definition if it has to be created . @param string [ " " ] game_id The game id to create the item with or the game id of an existing item . @param string def_name The item definition name to look up when creating the item if it one did not exist . @returns am . item The newly created item or returns an existing item with the same game_id . @returns boolean True if the item was newly created or false if it already existed .
int Item_ctor(lua_State *lua)
	{
		int args = lua_gettop(lua);
		if (args == 1 && !lua_isstr(lua, 1) || 
			args > 1 && !lua_isstr(lua, 1) && !lua_isstr(lua, 2))
		{
			return LuaState::expectedArgs(lua, "@new", 3, "", "string id", "string id, string def_name");
		}
		if (args == 0)
		{
			Item *item = new Item();
			wrapRefObject<Item>(lua, item);
			lua_pushboolean(lua, true);
			return 2;
		}
		bool newItem = false;
		const char *id = lua_tostring(lua, 1);
		base::Handle<Item> item(dynamic_cast<Item *>(Engine::getEngine()->getGameObject(id)));
		if (!item)
		{
			newItem = true;
			item = Engine::getGame()->create<Item>(lua_tostring(lua, 2), true);
			item->setGameId(id);
		}
		wrapRefObject<Item>(lua, item);
		lua_pushboolean(lua, newItem);
		return 2;
	}
int Item_ctor ( lua_State * lua ) { int args = lua_gettop ( lua ) ; if ( args == 1 && ! lua_isstr ( lua , 1 ) || args > 1 && ! lua_isstr ( lua , 1 ) && ! lua_isstr ( lua , 2 ) ) { return LuaState :: expectedArgs ( lua , " " , 3 , " " , " " , " " ) ; } if ( args == 0 ) { Item * item = new Item ( ) ; wrapRefObject < Item > ( lua , item ) ; lua_pushboolean ( lua , true ) ; return 2 ; } bool newItem = false ; const char * id = lua_tostring ( lua , 1 ) ; base :: Handle < Item > item ( dynamic_cast < Item * > ( Engine :: getEngine ( ) -> getGameObject ( id ) ) ) ; if ( ! item ) { newItem = true ; item = Engine :: getGame ( ) -> create < Item > ( lua_tostring ( lua , 2 ) , true ) ; item -> setGameId ( id ) ; } wrapRefObject < Item > ( lua , item ) ; lua_pushboolean ( lua , newItem ) ; return 2 ; }
@static
 Behaves the same as the base constructor however the new item will be created
 from the given item definition if it has to be created.
@static Behaves the same as the base constructor however the new item will be created from the given item definition if it has to be created .