This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GameView { | |
var playerNumber | |
var cppView | |
def GameView(playerNumber) { | |
// Uses copy constructor | |
playerNumber = playerNumber | |
// does not use copy constructor | |
cppView := createGameView("MatchView") | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
myFunc(2); | |
} | |
catch (e) : type(e, "int") { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def maybeCallMe(x) : x > 2 && x < 5 { | |
} | |
def maybeCallMe(x) : x >= 5 { | |
} | |
maybeCallMe(3) // Calls the top one | |
maybeCallMe(6) // Calls the second one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nextPlayer(player) { | |
return ((player + 1) % 4) | |
} | |
// typed (optional) | |
def nextPlayer2(int player) { | |
return ((player + 1) % 4) | |
} | |
def getPlayerPositionRelativeTo(refPlayer, targetPlayer) { | |
if (refPlayer == targetPlayer) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ code | |
ChaiScript chai; | |
chai.add(user_type<IBasicGameView>(), "IBasicGameView"). | |
add(user_type<IGameMatchView>(), "IGameMatchView"). | |
add(user_type<IGameMatchView::Player>(), "IGameMatch_Player"). | |
add(user_type<OnlineRoomsView::MatchRoom>(), "OnlineRoomsView_MatchRoom"). | |
add(user_type<Guinyote::RuntimeConfig>(), "RuntimeConfig"); | |
// Support inheritance: | |
chai.add(base_class<IBasicGameView, IGameMatchView>()); | |
chai.add(base_class<IGameMatchView, GameMatchView>()); |
NewerOlder