Export tileset to Lua

(Conrad Mercer) #1

I’m looking to use Tilesets to define tiles in my game, but do this outside of a .tmx. It would be convenient to be able to export a tileset to a .lua file in the same way that a .tmx can be exported to one.

From the code I can see that tilesets can already be outputted to Lua but the option is disabled in the UI… It seems fairly harmless to me to enable the ‘Export As’ option for a tileset and allow for the Lua type.

I’m sure this has been thought about before so please give me some feedback as to reasons for / against etc.

Looking at the code it looks like this should be a relatively straightforward addition (providing that the other export formats be ignored).

(Thorbjørn Lindeijer) #2

Indeed, it should be possible to add this. There’s the following issue about it:

I’ve done a stab at it myself at some point, but aborted the change for some reason (unfortunately I can’t remember what I ran into). Please feel free to have a go at it. I’m available in case you have any questions, and I’m looking forward to your pull request!

(Conrad Mercer) #3

Hmmm… The fact that you abandoned the work isn’t heartening, there are almost certainly speed bumps that I don’t see yet.

I’m going to take a crack at doing this now, I’ll put together the fix in a rough state and then pull request so you can take a look and see if it seems broadly acceptable or not.

(Conrad Mercer) #4

What max compiler versions are allowed for Tiled? I’m using g+±5.4.1. Couldn’t see this info on the GitHub page.

(Conrad Mercer) #5

@bjorn, I’ve created a PR with a very rough set of changes. I’ve basically hacked until I got the desired outcome that I was after. I’m hoping that from here you can take a look and we can discuss further as I’m a complete noob to the codebase. Think of the changes as a conversation starter rather than a serious end game PR :wink:

(Thorbjørn Lindeijer) #6

There is no maximum compiler version. There is only the requirement that the compiler supports C++11.

I’ll gave a look at the PR. :slight_smile: