Using p8tool listrawlua or a normal .p8 cartridge (that would work with listlua) will output:
Traceback (most recent call last):
File "/usr/local/bin/p8tool", line 8, in
sys.exit(tool.main(sys.argv[1:]))
File "picotool-repo/pico8/tool.py", line 592, in main
return args.func(args)
File "picotool-repo/pico8/tool.py", line 195, in listrawlua
lua_lines = raw_lua.split(b'\n')
AttributeError: 'list' object has no attribute 'split'
from the source code of def listrawlua(args) in tool.py, raw_lua is defined as either:
data = game.Game.get_raw_data_from_p8png_file(fh, fname)
raw_lua = data.code
data = game.Game.get_raw_data_from_p8_file(fh, fname)
raw_lua = data.section_lines['lua']
I'm working with a .p8 so it must go through the second case, but data.section_lines seems to contain a list of lines, not a string.
The seemingly obvious fix is to use the list of lines directly:
lua_lines = raw_lua (or just use raw_lua, but name is less clear)
However, that adds a newline after every line in the output. To get rid of this, remove '\n' in those lines:
However, that may break the .p8.png case! I haven't tested that yet.
Maybe get_raw_data_from_p8_file needs to be adapted to remove the '\n', or get_raw_data_from_p8png_file to add them, it remains to be seen.
Using
p8tool listrawlua
or a normal .p8 cartridge (that would work withlistlua
) will output:from the source code of
def listrawlua(args)
intool.py
,raw_lua
is defined as either:data = game.Game.get_raw_data_from_p8png_file(fh, fname)
raw_lua = data.code
data = game.Game.get_raw_data_from_p8_file(fh, fname)
raw_lua = data.section_lines['lua']
I'm working with a .p8 so it must go through the second case, but data.section_lines seems to contain a list of lines, not a string. The seemingly obvious fix is to use the list of lines directly:
lua_lines = raw_lua
(or just use raw_lua, but name is less clear)However, that adds a newline after every line in the output. To get rid of this, remove
'\n'
in those lines:However, that may break the .p8.png case! I haven't tested that yet. Maybe get_raw_data_from_p8_file needs to be adapted to remove the
'\n'
, or get_raw_data_from_p8png_file to add them, it remains to be seen.