rust-lua53 icon indicating copy to clipboard operation
rust-lua53 copied to clipboard

unable to use a rust-lua module from a rust-lua host program ("multiple Lua VMs detected")

Open tinyplasticgreyknight opened this issue 7 years ago • 3 comments

I'm trying to use a host program which embeds lua using rust-lua53 when some of the scripts import modules which are also written using rust-lua53.

The problem seems to be that luaL_checkversion() fails because it is seeing the host and the module as having two distinct VM memory spaces, hence the "multiple Lua VMs detected" error message.

Small test case here: https://github.com/tinyplasticgreyknight/lua-embed-test

I'd copied the sample implementations of host and module, so hopefully I'm not too off-track here.

tinyplasticgreyknight avatar Nov 10 '16 18:11 tinyplasticgreyknight

Forgot to mention, this is on Linux 64-bit. I ran into issue #73 while trying to reproduce on Windows. :-(

tinyplasticgreyknight avatar Nov 10 '16 19:11 tinyplasticgreyknight

Using the standalone reference interpreter, I can require() the module in that test case just fine, and call its provided function. This makes me suspect I'm doing something wrong with the host executable.

tinyplasticgreyknight avatar Nov 11 '16 00:11 tinyplasticgreyknight

I can confirm it is indeed broken on windows too. Compiled with stable-x86_64-pc-windows-msvc.

bpglaser avatar Jul 04 '17 11:07 bpglaser