Skip to content

Commit 0a84786

Browse files
committed
test
1 parent 6ef44e9 commit 0a84786

7 files changed

Lines changed: 249 additions & 0 deletions

File tree

.github/workflows/build.yml

Whitespace-only changes.

customize.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extract "$ZIPFILE" 'mylua.lua' "$MODPATH"
2+
extract "$ZIPFILE" 'mylua.lua' "$MODPATH"

module.prop

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
id=mylua
2+
name=lua test module
3+
version=1
4+
versionCode=1
5+
author=Admirepowered
6+
description=Lua test module

my_lua_module/Cargo.lock

Lines changed: 187 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

my_lua_module/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "my_lua_module"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[lib]
7+
name = "hello"
8+
crate-type = ["cdylib"]
9+
10+
[dependencies]
11+
mlua = { version = "0.9", features = ["lua54", "module"] }

my_lua_module/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
use mlua::prelude::*;
3+
4+
fn hello(_: &Lua,name: String)-> LuaResult<()>{
5+
println!("hello,{}!",name);
6+
Ok(())
7+
}
8+
#[mlua::lua_module]
9+
fn my_module(lua: &Lua) -> LuaResult<LuaTable>{
10+
11+
let exports = lua.create_table()?;
12+
exports.set("say_hello",lua.create_function(hello)?)?;
13+
Ok(exports)
14+
}

mylua.lua

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
local M = {}
3+
4+
function M.test()
5+
print("running test.test")
6+
info("called test.test")
7+
end
8+
9+
function M.start()
10+
install_module("/data/adb/modules/test/module.zip")
11+
end
12+
13+
function M.set()
14+
setConfig("wode","adwfihiowafhoiwhqfoi")
15+
end
16+
function M.get()
17+
local dd=getConfig("wode")
18+
info(dd)
19+
print(dd)
20+
end
21+
function M.lsp()
22+
modules.zygisk_lsposed.test()-- exaplme to call zygisk_lspoed function
23+
end
24+
function M.extend()-- extend to other module to call
25+
local hello = require("hello")
26+
hello.say_hello() --call rust function
27+
end
28+
29+
return M

0 commit comments

Comments
 (0)