Log In  


PICO-8 0.1.11b

The new editor tabs are really handy for keeping code organized, but currently there's no way to rearrange the tabs to influence how a cart's source code is assembled.

Currently, the code is assembled with [TAB0] first, then [TAB1], etc.

For example, if i have . . .


[TAB0]

function fn0()
  --
end

[TAB1]

function fn1()
  --
end

. . . that seems to get assembled as . . .


function fn0()
  --
end

function fn1()
  --
end

That means something like this won't work


[TAB0]

my_update=start_screen_update
my_draw=start_screen_draw

function _update()
  my_update()
end

function _draw()
  my_draw()
end

[TAB1]

function start_screen_update()
  --
end

function start_screen_draw()
  cls()
  print("start_screen_draw")
end

(my_update is nil because start_screen_update is not yet defined on [TAB0] LINE 1)

But if i swap the contents of [TAB0] and [TAB1] it works.



Are you saying you want tab order independent from compile order?

If so, how do you propose showing/setting those things up? Tab order is obviously a gui thing, but how do suggest zep could allow us to reorder compilation?

Seems it would require a separate control structure/file/section.


Why use function pointers like that though? If you just call the functions directly, you would not have that problem, right?


You want to initialize your state globals in _init(). All top-level definitions (in all tabs) will be executed before _init() is called. That's why there is _init().

A direct answer to your question: you can edit the .p8 file in a text editor and re-order the code regions. Each tab's worth of code is delimited by a comment that looks like this:

-->8

derp! _init() function works. that's a much better solution.

thanks dddaaannn



[Please log in to post a comment]