Skip to content

Instantly share code, notes, and snippets.

@stpettersens
Last active August 29, 2015 14:26
Show Gist options
  • Save stpettersens/50de389360f3a2ad03ac to your computer and use it in GitHub Desktop.
Save stpettersens/50de389360f3a2ad03ac to your computer and use it in GitHub Desktop.
Cheat sheet for porting between CoffeeScript, Dart, Haxe, TypeScript and Lua.

Cheat sheet for CoffeeScript, Dart, Haxe, TypeScript and Lua.

Cheat sheet for porting between CoffeeScript, Dart, Haxe, TypeScript and Lua.

Types

Types supported.

TypesLanguage
(Implicit typing)CoffeeScript, Lua
num, int, double, String, bool, dynamic, Object, List<T>Dart
Int, Float, String, Bool, Dynamic, Array<T>, Vector<T>Haxe
number, string, boolean, any, Object, Array<T>TypeScript

Variables

Declaring / initializing variables (assume an integer).

DeclarationLanguage
myVar = 1CoffeeScript
int myVar = 1; (or) var myVar = 1;Dart
var myVar: Int = 1;Haxe
var myVar: number = 1;TypeScript
(local) myVar = 1Lua

String interpolation

String interpolation usage.

String interpolationLanguage
"Value is: #{myVar}"CoffeeScript
"Value is: ${myVar}"Dart, TypeScript
"Value is: $myVar"Haxe
string.format("Value is %s", myVar)Lua

Constructor

Constructors for classes.

ConstructorLanguage
constructor: ()CoffeeScript
MyClass()Dart
public function new()Haxe
constructor()TypeScript
function MyClass.create()Lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment