Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Native types and haXe types


haXe defines some types that may already exist in the target platform.

For example, haXe defines the Array class. The Array class is already defined on almost all target platforms. The thing is that on some targets, the haXe array and the native array may indeed be different.

In such cases, when working with externs, you may need to convert from a haXe array to a native array and vice-versa.

You have to pay particular attention to that when working with Neko and PHP.

The Neko and PHP cases

If you are targeting Neko or PHP, then you will have to pay particular attention to array and string. Indeed, in the Neko and PHP packages, you will find the native array and native string types.

There are also 'functions and methods that you can use to convert a native type to the haXe one.

PHP functions

The following are the functions that you can use in PHP to convert from native types to haXe types:

Functions

Explanation

php.Lib.associativeArrayOfHash

This function creates...