Skip to content

Commit

Permalink
update mlua to 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Oct 26, 2024
1 parent 1c2325e commit f26e594
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
11 changes: 6 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ rmpv = "1.0"
#
redis = { version = "0.27", default-features = false }
#
mlua = "0.9"
mlua = "0.10"
pyo3 = { version = "0.22", default-features = false, features = ["auto-initialize"] }
#
cfg-if = "1.0"
Expand Down
8 changes: 4 additions & 4 deletions g3proxy/src/auth/source/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ async fn call_lua_report_ok(script: PathBuf) -> anyhow::Result<()> {

let report_ok = lua
.globals()
.get::<_, Function>("reportOk")
.get::<Function>("reportOk")
.map_err(|e| anyhow!("failed to load reportOk function: {e}"))?;
report_ok
.call::<_, ()>(Value::Nil)
.call::<()>(Value::Nil)
.map_err(|e| anyhow!("failed to call reportOk: {e}"))?;
Ok(())
})
Expand All @@ -181,10 +181,10 @@ async fn call_lua_report_err(script: PathBuf, e: String) -> anyhow::Result<()> {

let report_err = lua
.globals()
.get::<_, Function>("reportErr")
.get::<Function>("reportErr")
.map_err(|e| anyhow!("failed to load reportErr function: {e}"))?;
report_err
.call::<_, ()>(e)
.call::<()>(e)
.map_err(|e| anyhow!("failed to call reportErr: {e}"))?;
Ok(())
})
Expand Down
2 changes: 1 addition & 1 deletion g3proxy/utils/lua/src/cmd_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn command() -> Command {
pub fn display(lua: &Lua) -> anyhow::Result<()> {
let version = lua
.globals()
.get::<_, String>("_VERSION")
.get::<String>("_VERSION")
.map_err(|e| anyhow!("failed to get _VERSION variable: {e}"))?;

println!("lua version: {version}");
Expand Down

0 comments on commit f26e594

Please sign in to comment.