Skip to content

Commit 1878bec

Browse files
committed
fix lua seri
1 parent 44ed7e9 commit 1878bec

File tree

7 files changed

+18
-22
lines changed

7 files changed

+18
-22
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
}
2121
},
2222
"args": [
23-
"--socket=5007"
23+
2424
],
2525
"cwd": "${workspaceFolder}"
2626
},

publish/UnixPublish.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
cargo build --release
44

5-
if [ ! -d "dist" ]; then
6-
mkdir dist
5+
if [ -d "dist" ]; then
6+
rm -rf dist
77
fi
88

9-
cp target/release/lua-language-server.exe dist/
9+
mkdir dist
10+
11+
cp target/release/lua-language-server dist/
1012

1113
cp -r resources dist/

publish/WinPublish.ps1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
cargo build --release
22

3-
if (-Not (Test-Path -Path "dist")) {
4-
New-Item -ItemType Directory -Path "dist"
3+
$distPath = "dist"
4+
5+
if (Test-Path -Path $distPath) {
6+
Remove-Item -Path $distPath -Recurse -Force
57
}
68

7-
Copy-Item -Path "target/release/lua-language-server.exe" -Destination "dist/"
9+
New-Item -ItemType Directory -Path $distPath
10+
11+
Copy-Item -Path "target/release/lua-language-server.exe" -Destination $distPath
812

9-
Copy-Item -Path "resources" -Destination "dist/" -Recurse
13+
Copy-Item -Path "resources" -Destination $distPath -Recurse

resources/testmain.lua

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,8 @@ local thread = require 'bee.thread'
77
local taskpad = thread.channel('taskpad')
88
print("hello world2")
99
local counter = 0
10-
while true do
11-
print("hello world")
12-
taskpad:push(counter)
13-
counter = counter + 1
14-
thread.sleep(100)
15-
end
10+
taskpad:push("hello world", "hello world2", counter)
1611
]])
17-
-- thread.sleep(100)
18-
print("hello world")
19-
-- coroutine.yield()
20-
print("thread 1", d, "hello world")
2112
while true do
2213
print(d:bpop())
2314
end

src/bee/lua_thread.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ impl UserData for LuaChannel {
113113
let data = receiver.lock().unwrap().recv().await;
114114
if let Some(data) = data {
115115
let lua_seri_unpack = lua.globals().get::<LuaFunction>("lua_seri_unpack")?;
116-
let mut returns = lua_seri_unpack.call::<mlua::MultiValue>(data).unwrap();
117-
returns.insert(0, mlua::Value::Boolean(true));
116+
let returns = lua_seri_unpack.call::<mlua::MultiValue>(data).unwrap();
118117
return Ok(returns);
119118
}
120119
}

src/lua_seri/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ unsafe extern "C-unwind" fn lua_seri_pack(lua_state: *mut lua_State) -> i32 {
1414
return 0;
1515
}
1616

17-
let buffer_id = seri_pack(lua_state, 1, std::ptr::null_mut());
17+
let buffer_id = seri_pack(lua_state, 0, std::ptr::null_mut());
1818
ffi::lua_pushinteger(lua_state, buffer_id as i64);
1919
1
2020
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async fn main() -> LuaResult<()> {
2323
}
2424

2525
build_args(&lua);
26-
let main = lua.load(path::Path::new("resources/testmain.lua"));
26+
let main = lua.load(path::Path::new("resources/main.lua"));
2727
main.call_async(()).await?;
2828
Ok(())
2929
}

0 commit comments

Comments
 (0)