Defold naitive extension in nim-lang

Hi All :
i annoounce a python cli library to create naitive extensions for Defold using nim-lang :

Nimc

command line utilty in order to create Defold naitive extensions in Nim .

:spades: Install


pip install nimc

:spades: Getting started

open terminal in root path of defold project :

:spades::spades: Create Extension named ext :


nimc init ext

:spades::spades: Build project :


nimc build ext

:spades::spades: Add the extension to game.project file :

under section library → include dirs = /ext/ext

:spades::spades: Usage of naitive extension :

in any script file :


local result = ext.add(10,12)

print(result)

6 Likes

Sounds quite confusing to me at first but after a while researching, I understand what it does.

1 Like

check ext/nim/lib.nim where you should write your nim code