ReplaceMarkers, :: (no RunAtExpressionS).

This commit is contained in:
Glenn Maynard
2005-09-06 04:36:20 +00:00
parent f5f2f4a885
commit faf1ee5808
2 changed files with 26 additions and 4 deletions
+14 -2
View File
@@ -824,7 +824,7 @@ void ColorBitmapText::SetMaxLines( int iNumLines, int iDirection )
}
// lua start
#include "FontCharAliases.h"
class LunaBitmapText: public Luna<BitmapText>
{
public:
@@ -833,7 +833,19 @@ public:
static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; }
static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; }
static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; }
static int settext( T* p, lua_State *L ) { p->SetText( SArg(1) ); return 0; }
static int settext( T* p, lua_State *L )
{
CString s = SArg(1);
// XXX: Lua strings should simply use "\n" natively. However, some
// settext calls may be made from GetMetric() calls to other strings,
// and it's confusing for :: to work in some strings and not others.
// Eventually, all strings should be Lua expressions, but until then
// continue to support this.
s.Replace("::","\n");
FontCharAliases::ReplaceMarkers( s );
p->SetText( s ); return 0;
}
static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; }
static void Register(lua_State *L)
+12 -2
View File
@@ -75,7 +75,7 @@ void HelpDisplay::Update( float fDeltaTime )
#include "LuaBinding.h"
#include "FontCharAliases.h"
class LunaHelpDisplay: public Luna<HelpDisplay>
{
public:
@@ -88,7 +88,12 @@ public:
vector<CString> arrayTips;
LuaHelpers::ReadArrayFromTable( arrayTips, L );
lua_pop( L, 1 );
for( unsigned i = 0; i < arrayTips.size(); ++i )
{
// XXX: see BitmapText settext
arrayTips[i].Replace("::","\n");
FontCharAliases::ReplaceMarkers( arrayTips[i] );
}
if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) )
{
vector<CString> arrayTipsAlt;
@@ -96,6 +101,11 @@ public:
lua_pushvalue( L, 2 );
LuaHelpers::ReadArrayFromTable( arrayTipsAlt, L );
lua_pop( L, 1 );
for( unsigned i = 0; i < arrayTipsAlt.size(); ++i )
{
arrayTipsAlt[i].Replace("::","\n");
FontCharAliases::ReplaceMarkers( arrayTipsAlt[i] );
}
p->SetTips( arrayTips, arrayTipsAlt );
}