Title: 用 Lua 写 Android 应用? AutoLua 做到了 | BestBlogs.dev
URL Source: https://www.bestblogs.dev/article/1a4aa8d7?amp%3Butm_medium=feed&%3Butm_campaign=resources&%3Bentry=rss_article_item
Published Time: 2026-06-19 09:13:04
Markdown Content: 78
AutoLua bridges the complete Lua 5.3 runtime with Android APIs via LuaJava, allowing scripts to directly call native capabilities and build UIs, offering significantly more freedom than similar automation tools. 
Today 421 words (about 2 min) View Source →
Sign in to highlight text and take notes as you read. Sign in now
做了个小工具,技术栈 LuaJava + Lua 5.3 。核心思路是把完整 Lua 运行时和 Android API 桥接,让脚本能直接调原生能力。
技术层面几个点
* Lua 5.3 完整运行时,不是阉割版、不是类 Basic 语法。Goto 、协程、位运算全有
* import "android.graphics.Bitmap" 原生调用,零中间层。想调什么调什么,不等封装、不等更新
* .alp 压缩工程格式,透明不加密,脚本归属权是用户自己的。随时导出、分享、备份
* 内置 AES/RSA/MD5/Base64 加解密,网络请求、多线程全支持
一段代码说清楚
-- import 直接用,零封装
import "android.widget.*"
import "android.content.Intent"
import "android.net.Uri"-- 布局表构建 UI ,不是拖控件
layout = {
LinearLayout,
orientation = "vertical",
{ Button, text = "点我", id = "btn" },
}
activity.setContentView(LoadLayout(layout))
-- 事件绑定 — getter/setter 简写
btn.onClick = function(v)
print("clicked")
-- 直接调系统 API
local intent = Intent(Intent.ACTION_VIEW)
intent.setData(Uri.parse("https://www.autolua.top"))
activity.startActivity(intent)
end
对比同类工具
| | AutoLua | 按键精灵 | Tasker | Auto.js | | --- | --- | --- | --- | --- | | 语言 | Lua 5.3 完整 | 类 Basic | 可视化 | JavaScript | | 调 Java API | import 直接用 | 不支持 | 有限 | 有限 | | UI 构建 | 代码自由画 | 录制/模板 | 模板 | 模板 | 自由度不在一个维度。 Lua 不只是脚本语言,加 LuaJava 桥接后它成了 Android 的一等公民。
文档
欢迎搞机玩家和技术同好来玩。
* 官网:https://www.autolua.top/(下载 APK / 在线文档 / 功能演示) * 文档 & 网站源码( Gitee ):https://gitee.com/autoluapro/autolua_doc * 文档 & 网站源码( GitHub ):https://github.com/autolua/autolua_doc