lua/wrappers/game/lua_game.cpp
/**
	 * Registers a character with the given definition name.
	 * Definition names are always namespaced to the file they were loaded from.
	 * For example <code>filename:defname</code><span> This filename should be relative
	 * to the </span><code>data/defs/</code><span> folder. If no filename is given then the current
	 * file being loaded will be used.
	 * 
	 * The files under </span><code>data/defs/</code><span> will be automatically loaded
	 * when a definition with their filename is used. Definitions can also be
	 * registered from outside of those files, however they will need to always
	 * provide a filename. Definitions can be overridden.</span>
	 *
	 * @param string def_name The name to store the character definition under.
	 * @param am.character def The character definition to store.
	 * @returns am.game This
	 */
Registers a character with the given definition name.
Definition names are always namespaced to the file they were loaded from.
For example filename:defname This filename should be relative
to the data/defs/ folder. If no filename is given then the current
file being loaded will be used.

The files under data/defs/ will be automatically loaded
when a definition with their filename is used. Definitions can also be
registered from outside of those files, however they will need to always
provide a filename. Definitions can be overridden.

@param string def_name The name to store the character definition under.
@param am.character def The character definition to store.
Registers a character with the given definition name . Definition names are always namespaced to the file they were loaded from . For example filename : defname This filename should be relative to the data / defs / folder . If no filename is given then the current file being loaded will be used . The files under data / defs / will be automatically loaded when a definition with their filename is used . Definitions can also be registered from outside of those files however they will need to always provide a filename . Definitions can be overridden . @param string def_name The name to store the character definition under . @param am . character def The character definition to store .
int Game_char_def(lua_State *lua)
	{
		Game *game = castUData<Game>(lua, 1);
		if (game)
		{
			if (lua_isstr(lua, 2))
			{
				if (lua_gettop(lua) == 2)
				{
					Character *obj = game->getCharDefinition(lua_tostring(lua, 2));
					if (obj)
					{
						wrapRefObject<Character>(lua, obj);
						return 1;
					}
					lua_pushnil(lua);
					return 1;
				}
				else if (lua_isnil(lua, 3))
				{
					game->addCharDefinition(nullptr, lua_tostring(lua, 2));
					lua_first(lua);
				}
				else
				{
					Character *obj = castUData<Character>(lua, 3);
					if (obj)
					{
						game->addCharDefinition(obj, lua_tostring(lua, 2));
						lua_first(lua);
					}
				}
			}
			return LuaState::expectedArgs(lua, "char_def", 3, "string def_name", "string def_name, am.character char", "string def_name, nil char");
		}
		return LuaState::expectedContext(lua, "char_def", "am.game");
	}
int Game_char_def ( lua_State * lua ) { Game * game = castUData < Game > ( lua , 1 ) ; if ( game ) { if ( lua_isstr ( lua , 2 ) ) { if ( lua_gettop ( lua ) == 2 ) { Character * obj = game -> getCharDefinition ( lua_tostring ( lua , 2 ) ) ; if ( obj ) { wrapRefObject < Character > ( lua , obj ) ; return 1 ; } lua_pushnil ( lua ) ; return 1 ; } else if ( lua_isnil ( lua , 3 ) ) { game -> addCharDefinition ( nullptr , lua_tostring ( lua , 2 ) ) ; lua_first ( lua ) ; } else { Character * obj = castUData < Character > ( lua , 3 ) ; if ( obj ) { game -> addCharDefinition ( obj , lua_tostring ( lua , 2 ) ) ; lua_first ( lua ) ; } } } return LuaState :: expectedArgs ( lua , " " , 3 , " " , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Registers a character with the given definition name.
Registers a character with the given definition name .