Попробуй этот
import os
def convert_lua_to_hxc(lua_file_path, hxc_file_path):
"""
Convert a Lua script file (.lua) to a .hxc file.
Args:
lua_file_path (str): The path to the input Lua file.
hxc_file_path (str): The path to the output .hxc file.
"""
try:
# Open the Lua file for reading
with open(lua_file_path, 'r') as lua_file:
lua_content = lua_file.read()
# Open the .hxc file for writing
with open(hxc_file_path, 'w') as hxc_file:
hxc_file.write(lua_content)
print(f"Successfully converted {lua_file_path} to {hxc_file_path}")
except FileNotFoundError:
print(f"Error: The file {lua_file_path} does not exist.")
except IOError as e:
print(f"Error: An I/O error occurred: {e}")
if __name__ == "__main__":
# Example usage
lua_file = "C:\\Users\\medve\\Downloads\\script_pack_in_a_cool_way_\\events (some do not work because they are old)\\3d notes shit.lua" # Input Lua file
hxc_file = "C:\\Users\\medve\\Downloads\\новый 1.hxc" # Output .hxc file
# Check if the input Lua file exists
if not os.path.exists(lua_file):
print(f"Error: The file {lua_file} does not exist.")
else:
# Convert the Lua file to .hxc format
convert_lua_to_hxc(lua_file, hxc_file)
Мой код(нейросети):
import os
def convert_lua_to_hxc(lua_file_path, hxc_file_path):
"""
Convert a Lua script file (.lua) to a .hxc file.
Args:
lua_file_path (str): The path to the input Lua file.
hxc_file_path (str): The path to the output .hxc file.
"""
try:
# Open the Lua file for reading
with open(lua_file_path, 'r') as lua_file:
lua_content = lua_file.read()
# Open the .hxc file for writing
with open(hxc_file_path, 'w') as hxc_file:
hxc_file.write(lua_content)
print(f"Successfully converted {lua_file_path} to {hxc_file_path}")
except FileNotFoundError:
print(f"Error: The file {lua_file_path} does not exist.")
except IOError as e:
print(f"Error: An I/O error occurred: {e}")
if __name__ == "__main__":
# Example usage
lua_file = "C:\Users\medve\Downloads\script_pack_in_a_cool_way_\events (some do not work because they are old)\3d notes shit.lua" # Input Lua file
hxc_file = "C:\Users\medve\Downloads\новый 1.hxc" # Output .hxc file
# Check if the input Lua file exists
if not os.path.exists(lua_file):
print(f"Error: The file {lua_file} does not exist.")
else:
# Convert the Lua file to .hxc format
convert_lua_to_hxc(lua_file, hxc_file)