Git Product home page Git Product logo

Comments (3)

jugglerchris avatar jugglerchris commented on August 19, 2024 2

Glad to be able to help!

from rlua.

jugglerchris avatar jugglerchris commented on August 19, 2024 1

Hi,
It looks like you've configured rlua with the default "builtin-lua54", but are trying to use luarocks installed with Lua 5.3.
To use the system-installed Lua 5.3 library instead, specify the dependency liks this in Cargo.toml:

rlua = { version = "0.19", default-features = false, features=["system-lua53"] }

Second, by default rlua disables C extensions for safety. lrand is a C extension so that needs enabling. Instead of Lua::new, you can use Lua::unsafe_new_with_flags:

let lua = unsafe { Lua::unsafe_new_with_flags(rlua::StdLib::ALL, rlua::InitFlags::NONE) };

Depending on your luarocks or Lua installations, you may also need to add the luarocks path to package.cpath, but I didn't need to do that on my Ubuntu 22.04 system with luarocks installed from the Ubuntu package.

Putting it together, this worked for me: https://github.com/jugglerchris/rlua_luarocks_lrand

rlua_luarocks_lrand$ luarocks-5.3 list

Rocks installed for Lua 5.3
---------------------------

lrand
   1.0.0-0 (installed) - /usr/local/lib/luarocks/rocks-5.3

rlua_luarocks_lrand$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/rlua_luarocks_lrand`
6708800777304496116

from rlua.

solo-fox avatar solo-fox commented on August 19, 2024

It is so good to get solutions from expertise rather than searching for days and trying ChatGPT capabilities.

Thanks, it solved the problem!

from rlua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.