Skip to content
Lucca Rodrigues edited this page Sep 2, 2021 · 12 revisions

External Editor

Version 0.80 and later

As of version 0.80, you can save (and load) your game directly as a Lua (or other script) file rather than a *.tic cart, for example:

save mygame.lua

The saved file will include your code and at the end, all resources (sprites, sfx etc) within XML-style tags. Care should be taken to avoid manually editing this data (unless intentionally required). TIC will automatically re-load any changes in the script file.

A typical workflow might be:

  • Create sprites, map, sfx and music in TIC's various resource editors and save in lua format from the console eg save mygame.lua
  • Open mygame.lua in your editor of choice; the resources created in the previous step will appear within XML style tags at the end of the file. Add your code at the top of the file.
  • If TIC is open, it will detect changes to the file whenever it's saved and automatically reload it. Switch to TIC to run your game or edit resources.
  • If TIC is not open, start it and use load mygame.lua to load your code and resources to further edit or run your game.

To avoid losing work, care should be taken to avoid making unsaved changes in an external editor and within TIC's resource editors at the same time!

Versions prior to 0.80:

There are two methods by which you can run code from an external Lua file:

  1. add dofile('game.lua') as the first line of the built-in editor and place game.lua in the correct location:
  • For Windows, the file should be in the same folder as your your executable.
  • For Unix/Linux it should be in the directory from which you started the tic binary.
  • For Android you need to specify the full path to your Lua file. For example, dofile('/sdcard/game.lua').
  1. use tic cart.tic -code game.lua command line parameters to inject your code to the cartridge

Extensions/packages for text editors

Clone this wiki locally