Skip to content

yasio/UnLua

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 25 commits ahead, 606 commits behind Tencent:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

LOGO

license release PRs Welcome

概述

UnLua是适用于UE的一个高度优化的Lua脚本解决方案。它遵循UE的编程模式,功能丰富且易于学习,UE程序员可以零学习成本使用。

在UE中使用Lua

  • 直接访问所有的UCLASS, UPROPERTY, UFUNCTION, USTRUCT, UENUM,无须胶水代码。
  • 替换蓝图中定义的实现 ( Event / Function )。
  • 处理各类事件通知 ( Replication / Animation / Input )。

更详细的功能介绍请查看功能清单

优化特性

  • UFUNCTION调用,包括持久化参数缓存、优化的参数传递、优化的非常量引用和返回值处理。
  • 访问容器类(TArray, TSet, TMap),内存布局与引擎一致,Lua Table和容器之间不需要转换。
  • 高效的结构体创建、访问、GC。
  • 支持自定义静态导出类、成员变量、成员函数、全局函数、枚举。

平台支持

  • 运行平台:Windows / Android / iOS / Linux / OSX
  • 引擎版本:Unreal Engine 4.17.x - Unreal Engine 5.x

注意: 4.17.x 和 4.18.x 版本需要对 Build.cs 做一些修改。

快速开始

安装

  1. 复制 Plugins 目录到你的UE工程根目录。
  2. 重新启动你的UE工程

开始UnLua之旅

注意: 如果你是一位UE萌新,推荐使用更详细的图文版教学继续以下步骤。

  1. 新建蓝图后打开,添加接口 UnLuaInterface
  2. 在接口的 GetModule 函数中填入Lua文件路径,如 GameModes.BP_MyGameMode_C
  3. 点击菜单栏中的 Lua Template 图标生成Lua模版文件
  4. 打开 Content/Script/GameModes/BP_MyGameMode_C.lua 编写你的代码

更多示例

模块说明

  • UnLua 主要运行时模块
  • UnLuaEditor 编辑器模块,提供Lua模版生成/智能提示导出/控制台命令等功能
  • UnLuaDefaultParamCollector 编码模块,收集UFUNCTION的默认参数
  • UnLuaTestSuite 自动化测试模块,覆盖了UnLua提供的API的规范测试以及一些Issue对应的回归测试

文档

许可证

  • UnLua根据MIT分发。

技术支持

  • 官方交流QQ群:936285107
  • 推荐VSCode插件:Lua Booster

About

A feature-rich, easy-learning and highly optimized Lua scripting plugin for UE4.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 92.2%
  • Lua 6.5%
  • Other 1.3%