Skip to content

Instantly share code, notes, and snippets.

@germandiagogomez
Created May 24, 2021 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save germandiagogomez/7557bd1c69c39247dd6980009057e164 to your computer and use it in GitHub Desktop.
Save germandiagogomez/7557bd1c69c39247dd6980009057e164 to your computer and use it in GitHub Desktop.
Class in ChaiScript
class GameView {
var playerNumber
var cppView
def GameView(playerNumber) {
// Uses copy constructor
playerNumber = playerNumber
// does not use copy constructor
cppView := createGameView("MatchView")
}
def someFunction(parameter) {
// Parameter can be printed via a "to_string" function
print("Hello ${parameter}")
}
}
auto myView = GameView(2)
myView.someFunction(MyPrintableClass())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment