add TrySelectCourse so that SelectCourse can be bound without having to change its protection

This commit is contained in:
AJ Kelly
2012-07-22 17:07:12 -05:00
parent 1fc5fe100e
commit 2edd2b31b5
2 changed files with 146 additions and 137 deletions
+10 -2
View File
@@ -1622,13 +1622,21 @@ public:
static int SelectSong( T* p, lua_State *L ) static int SelectSong( T* p, lua_State *L )
{ {
if( lua_isnil(L,1) ) { lua_pushboolean( L, false ); } if( lua_isnil(L,1) ) { lua_pushboolean( L, false ); }
else { Song *pS = Luna<Song>::check( L, 1, true ); lua_pushboolean( L, p->SelectSong( pS ) ); } else
{
Song *pS = Luna<Song>::check( L, 1, true );
lua_pushboolean( L, p->SelectSong( pS ) );
}
return 1; return 1;
} }
static int SelectCourse( T* p, lua_State *L ) static int SelectCourse( T* p, lua_State *L )
{ {
if( lua_isnil(L,1) ) { lua_pushboolean( L, false ); } if( lua_isnil(L,1) ) { lua_pushboolean( L, false ); }
else { Course *pC = Luna<Course>::check( L, 1, true ); lua_pushboolean( L, p->SelectCourse( pC ) ); } else
{
Course *pC = Luna<Course>::check( L, 1, true );
lua_pushboolean( L, p->TrySelectCourse( pC ) );
}
return 1; return 1;
} }
+1
View File
@@ -38,6 +38,7 @@ public:
Song *GetPreferredSelectionForRandomOrPortal(); Song *GetPreferredSelectionForRandomOrPortal();
bool SelectSong( const Song *p ); bool SelectSong( const Song *p );
bool TrySelectCourse( const Course *p ){ return TrySelectCourse(p); }
bool SelectSection( const RString & SectionName ); bool SelectSection( const RString & SectionName );
void SetOpenSection( RString group ); void SetOpenSection( RString group );
SortOrder GetSortOrder() const { return m_SortOrder; } SortOrder GetSortOrder() const { return m_SortOrder; }