当前位置: 首页 > news >正文

Lua之Lua源文件批量转换为luac字节码文件

准备的工具:luac.exe CSDNhttps://mp.csdn.net/mp_download/manage/download/UpDetailed

Unity版:

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;public static class Batch_LuaToLuac
{[UnityEditor.MenuItem("Tools/LuaToLuac")]static void ToLuac(){//准备进程信息string luacExe = "luac53.exe";  //luac.exe工具文件名string luacExe_Dir = @"D:\workspace\Test\T4\PureProject_Develop\Development2020\Tools\Lua"; //luac.exe工具路径string luacExe_fullpath = Path.Combine(luacExe_Dir, luacExe);   //luac.exe工具完整路径var processStartInfo = new System.Diagnostics.ProcessStartInfo();processStartInfo.FileName = luacExe_fullpath;processStartInfo.UseShellExecute = true;processStartInfo.ErrorDialog = true;processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;void DoExe(string srcFile, string outFile){//执行转换进程try{string args = string.Format("-o {0} {1}", outFile, srcFile);processStartInfo.Arguments = args;var process = System.Diagnostics.Process.Start(processStartInfo);process.WaitForExit();}catch (Exception ex){Debug.LogError(ex.ToString());}}//lua源文件路径var luaFileDir = Application.dataPath + "/LuaSource";//生成的luac文件路径var outPutDir = Path.Combine(luaFileDir, "luac");if (Directory.Exists(outPutDir)) Directory.Delete(outPutDir, true);Directory.CreateDirectory(outPutDir);var files = Directory.GetFiles(luaFileDir, "*.lua", SearchOption.TopDirectoryOnly);foreach (var file in files){if (file.Contains(".meta")) { continue; }var outFile = Path.Combine(outPutDir, Path.GetFileNameWithoutExtension(file) + ".luac");DoExe(file, outFile);}AssetDatabase.Refresh();}
}

http://www.lryc.cn/news/140858.html

相关文章:

  • 简历V1.0问题合集 8/25-26
  • P1052 [NOIP2005 提高组] 过河
  • ArrayList和Vector及LinkedList的区别
  • HVV爆火漏洞:最新 WPS RCE (远程命令执行) 复现
  • 我的128天创作纪念日-东离与糖宝
  • 卷积神经网络——下篇【深度学习】【PyTorch】【d2l】
  • cas md5加密
  • [管理与领导-51]:IT基层管理者 - 8项核心技能 - 6 - 流程
  • 天翼物联、汕头电信与汕头大学共建新一代信息技术与数字创新(物联网)联合实验室
  • Failed to load local image resource/images/1.jpg无法加载本地图片资源
  • Go和Java实现责任链模式
  • C#+GDAL影像处理笔记08:生成DEM的图阔范围线
  • 敏捷研发管理软件及敏捷管理流程
  • Mac OS 13.4.1 搜狗输入法导致的卡顿问题
  • vue 简单实验 自定义组件 局部注册
  • Resnet模型详解
  • AI 绘画Stable Diffusion 研究(十六)SD Hypernetwork详解
  • 2023.8 -java - 继承
  • 前端面试:【移动端开发】PWA、Hybrid App和Native App的比较
  • picGo+gitee+typora设置图床
  • [JavaWeb]【十三】web后端开发-原理篇
  • 服务注册中心 Eureka
  • SpringIoC组件的高级特性
  • Linux--进程地址空间
  • ISIS路由协议
  • 论文解读:Bert原理深入浅出
  • 共享内存 windows和linux
  • 一个mongodb问题分析
  • Vue3.0极速入门- 目录和文件说明
  • RabbitMQ---订阅模型-Direct