(args)
return 0
Run the listrawlua tool.

    Args:
      args: The argparser parsed args object.

    Returns:
      0 on success, 1 on failure.
Run the listrawlua tool.
Run the listrawlua tool .
def listrawlua(args):
    """Run the listrawlua tool.

    Args:
      args: The argparser parsed args object.

    Returns:
      0 on success, 1 on failure.
    """
    for fname in args.filename:
        if fname.endswith('.p8.png'):
            with open(fname, 'rb') as fh:
                data = game.Game.get_raw_data_from_p8png_file(fh, fname)
                raw_lua = data.code.split(b'\n')
        elif fname.endswith('.p8'):
            with open(fname, 'rb') as fh:
                data = game.Game.get_raw_data_from_p8_file(fh, fname)
                raw_lua = data.section_lines['lua']
        else:
            util.error('{}: must be .p8 or .p8.png\n'.format(fname))
            if len(args.filename) == 1:
                return 1
            continue

        if len(args.filename) > 1:
            util.write('=== {} ===\n'.format(fname))
        for i, l in enumerate(raw_lua):
            if args.show_line_numbers:
                util.write('{}: {}\n'.format(i, _as_friendly_string(l)))
            else:
                util.write(_as_friendly_string(l) + '\n')
        util.write('\n')

    return 0
def listrawlua ( args ) : for fname in args . filename : if fname . endswith ( '.p8.png' ) : with open ( fname , 'rb' ) as fh : data = game . Game . get_raw_data_from_p8png_file ( fh , fname ) raw_lua = data . code . split ( b'\n' ) elif fname . endswith ( '.p8' ) : with open ( fname , 'rb' ) as fh : data = game . Game . get_raw_data_from_p8_file ( fh , fname ) raw_lua = data . section_lines [ 'lua' ] else : util . error ( '{}: must be .p8 or .p8.png\n' . format ( fname ) ) if len ( args . filename ) == 1 : return 1 continue if len ( args . filename ) > 1 : util . write ( '=== {} ===\n' . format ( fname ) ) for i , l in enumerate ( raw_lua ) : if args . show_line_numbers : util . write ( '{}: {}\n' . format ( i , _as_friendly_string ( l ) ) ) else : util . write ( _as_friendly_string ( l ) + '\n' ) util . write ( '\n' ) return 0