lua/wrappers/gfx/lua_font.cpp
/**
	 * Returns the pixel width of the first character in the given string. This will always be
	 * the same for mono spaced fonts.
	 *
	 * @param string char The character to check.
	 * @returns number The width of the given character.
	 */
Returns the pixel width of the first character in the given string. This will always be
the same for mono spaced fonts.

@param string char The character to check.
@returns number The width of the given character.
Returns the pixel width of the first character in the given string . This will always be the same for mono spaced fonts . @param string char The character to check . @returns number The width of the given character .
int Font_char_width(lua_State *lua)
	{
		Font *font = castUData<Font>(lua, 1);
		if (font)
		{
			if (lua_isnum(lua, 2))
			{
				lua_pushnumber(lua, font->getCharWidth(lua_tointeger(lua, 2)));
				return 1;
			}
			else if (lua_isstr(lua, 2))
			{
				lua_pushnumber(lua, font->getCharWidth(lua_tostring(lua, 2)[0]));
				return 1;
			}
			return LuaState::expectedArgs(lua, "char_width", 2, "integer char_code", "string char");
		}
		return LuaState::expectedContext(lua, "char_width", "am.font");
	}
int Font_char_width ( lua_State * lua ) { Font * font = castUData < Font > ( lua , 1 ) ; if ( font ) { if ( lua_isnum ( lua , 2 ) ) { lua_pushnumber ( lua , font -> getCharWidth ( lua_tointeger ( lua , 2 ) ) ) ; return 1 ; } else if ( lua_isstr ( lua , 2 ) ) { lua_pushnumber ( lua , font -> getCharWidth ( lua_tostring ( lua , 2 ) [ 0 ] ) ) ; return 1 ; } return LuaState :: expectedArgs ( lua , " " , 2 , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Returns the pixel width of the first character in the given string.
Returns the pixel width of the first character in the given string .