We’d love to hear from you. Whether you have a question that you’d like us to answer as part of our FAQ,  you’ve identified something that just doesn’t quite look right in one of our tutorials, you have a business opportunity or for any other reason, please use this simple form to contact us.

We’ll do our best to provide a prompt response.

Like what you see?...pass it on!

Using External Libraries in Armory

In this quick tutorial we are going to look at how to use external Haxe libraries in your Armory game. The process is fairly simple but not really intuitive.  First you need to acquire a library. In this demonstration I am going to use the haxe-strings library. Find the github link of the repository.  Next in your project directory, create a folder called Libraries. In a terminal change into the newly created library and clone your repository using the command:

git clone path/to/github.com

Now we need to let Armory/Kha know that we want to use this newly added library. In order to do this we add a text data file in Blender. Switch to a Text Editor window:

Text Editor Window

Now click the New button:

New Window - Text Editor

Name the text block, like so:

Text Block

Now enter the following text:


Next we need to tell Armory about our extension to the khafile. In the Scene settings panel, locate the Modules section and add your text block to the Khafile section, like so:

Scene Settings Panel - Using External Libraries in Armory

This tells Armory/Kha about our added library, this text will be added to the auto generated khafile.js, used by the kha build engine. Now we can use the external library in our Haxe code, like so:

package arm;
using hx.strings.Strings;

class MyTrait extends iron.Trait {
  public function new() {
    var set = new hx.strings.collection.StringSet();
    set.add("Hello World");
    set.add("Goodbye World");

Please note that for some reason Kode Studio may have trouble finding your code until you do a first build, and even after that may give you some false warnings about your using statement not being found. I am honestly not sure why, seems like a bug.

Armory Compatible Animation<<PreviousTable of Contents

Like what you see?...pass it on!

script ends --->