New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the mlua example is broken #54
Comments
And the example # nvim-oxi/examples/api
cargo b && mkdir lua -p && mv target/debug/libapi.so lua/api.so -fn
# nvim
set_rtp=":set rtp+=$PWD"
cmd="
:lua require'api'
"
RUST_BACKTRACE=1 nvim -u NONE --headless +"$set_rtp" +"$cmd" +quit
which points to here. |
1. add testing bash scripts for examples 2. add `src/test.rs` which takes snapshots for: * calc & mechanic: succeeded * mlua & api: failed noib3#54
I can't replicate the first issue. If I enable the The |
I've just updated the |
For the api example, I use the |
|
you're assigning |
This should be fixed. Could you try building the mlua example w/ |
I'm testing the other examples. E5108: Error executing lua "replace_keycodes is not a boolean"
stack traceback:
[C]: at 0x7f95ded80ba0
[C]: in function 'require'
[string ":lua"]:2: in main chunk |
# content of ./examples.sh
# build so
cargo b -q --example api --features neovim-nightly
cargo b -q --example mlua --features mlua,neovim-nightly
cargo b -q --example calc --features neovim-nightly
cargo b -q --example mechanic --features neovim-nightly
# mv so
test_dir=./_example-tests
rm $test_dir -rf && mkdir $test_dir
cd $test_dir
source=../target/debug/examples/
mv $source/libapi.so ./api.so -fn
mv $source/libmlua.so ./mlua.so -fn
mv $source/libcalc.so ./calc.so -fn
mv $source/libmechanic.so ./mechanic.so -fn
# test
function test() {
echo === example: $1 ===
nvim -u NONE --headless +":lua $2" +"$3"
echo
}
api="
local api = require'api'
vim.cmd [[
:Greetings
:exe 'norm ' . 'ihi' . \"\<c-c>\"
]]
api.open_window()
api.close_window()
"
test api "$api" ":%p | q!"
mlua="require'mlua'.greetings()"
test mlua $mlua q
calc="
local calc = require'calc'
print(calc.add(1, 41))
print(calc.multiply(2, 21))
print(calc.compute(function(a, b) return a + b; end, 1, 41))
print(calc.compute(function(a, b) return a * b; end, 2, 21))
"
test calc "$calc" q
mechanic="
local mechanic = require('mechanic')
local fixed = mechanic.fix({
manufacturer = 'Tesla',
miles = 69420,
works = false,
problem = 'kills_pedestrians',
})
assert(fixed.works)
assert(fixed.problem == nil)
"
test mechanic "$mechanic" q I use this script to test examples based on the latest commit, and get the errors: === example: api ===
Hello from Rust!LuaJIT ASSERT lj_api.c:157: lua_settop: bad stack slot -2
examples.sh: line 18: 2431819 Aborted nvim -u NONE --headless +":lua $2" +"$3"
=== example: mlua ===
LuaJIT ASSERT lj_api.c:157: lua_settop: bad stack slot -2
examples.sh: line 18: 2431820 Aborted nvim -u NONE --headless +":lua $2" +"$3"
=== example: calc ===
LuaJIT ASSERT lj_api.c:40: index2adr: bad stack slot -1
examples.sh: line 18: 2431821 Aborted nvim -u NONE --headless +":lua $2" +"$3"
=== example: mechanic ===
Error detected while processing command line:
E5108: Error executing lua [string ":lua"]:12: assertion failed!
stack traceback:
[C]: in function 'assert'
[string ":lua"]:12: in main chunk |
fixed, all the examples should work now |
Just a heads up, I was having issues with the API examples (api.open_window() command), which lead me to this thread. I went to test out the script posted above, and ended up with the same issue _ ✗ ./examples.sh
=== example: api ===
Hello from Rust
Error detected while processing command line:
E5108: Error executing lua Value of type () couldn\'t be pushed on the stack: "non-float cannot have \'row\'"
stack traceback:
[C]: in function 'open_window'
[string ":lua"]:7: in main chunk
hello
=== example: mlua ===
Hello from nvim-oxi..
..and goodbye from mlua!
Error detected while processing command line:
E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value
stack traceback:
[string ":lua"]:1: in main chunk
=== example: calc ===
42
42
42
42
=== example: mechanic ===
Hands on the wheel!! |
And I got
If
:lua require'lua'.greetings()
is run in nvim cmd, nvim just always prints them without stop.The mlua features I use is this:
mlua = { version = "0.8", features = ["luajit", "vendored"] }
because Lua is not installed locally.
The text was updated successfully, but these errors were encountered: