# How can we install Lua modules with LuaRocks?

**URL:** <https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [July 7, 2021, 11:15am UTC](https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767 "2021-07-07T11:15:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tsen](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@Tsen](https://forum.heroiclabs.com/u/Tsen)\
**Post date:** [July 7, 2021, 11:15am UTC](https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767/1 "2021-07-07T11:15:12Z")

</div>

Hello, I want to use FlatBuffers to send data with lua.  
This is FlatBuffers library:

> **[GitHub - google/flatbuffers: FlatBuffers: Memory Efficient Serialization Library](https://github.com/google/flatbuffers)**
>
> FlatBuffers: Memory Efficient Serialization Library - GitHub - google/flatbuffers: FlatBuffers: Memory Efficient Serialization Library

However, nakama lua runtime is Lua5.1. We need to install modules like compat53 (For Lua5.3 string.pack, etc.) for FlatBuffers.  
I think we can use luarocks to install to run FlatBuffers on nakama lua runtime. How can we install dependencies module on nakama lua runtime with luarocks? Or do we need to import like compat53 library to data/modules to let FlatBuffers work?

Thanks!

---

<div class="post-metadata">

**Author:** ![sean](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sean/32/643_2.png) [@sean](https://forum.heroiclabs.com/u/sean)\
**Post date:** [July 27, 2021, 9:42am UTC](https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767/2 "2021-07-27T09:42:43Z")

</div>

Hi @Tsen we’d recommend installing a local Lua 5.1 and LuaRocks setup, installing your required packages and copying the Lua files to your server project.

---

<div class="post-metadata">

**Author:** ![mofirouz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/mofirouz/32/1523_2.png) [@mofirouz](https://forum.heroiclabs.com/u/mofirouz)\
**Post date:** [August 5, 2021, 4:16am UTC](https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767/3 "2021-08-05T04:16:20Z")

</div>

In addition to what Sean mentioned - FlatBuffers with Lua won’t work in Nakama as it has native/c bindings, and the Lua VM shipped in Nakama is a virtual one. To use FlatBuffers, I suggest you write your custom logic in Go.

---

<div class="post-metadata">

**Author:** ![Tsen](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@Tsen](https://forum.heroiclabs.com/u/Tsen)\
**Post date:** [August 11, 2021, 7:39am UTC](https://forum.heroiclabs.com/t/how-can-we-install-lua-modules-with-luarocks/1767/4 "2021-08-11T07:39:48Z")

</div>

I try to use flatbuffers in Go after I know that gopher-lua only support pure Lua5.1. Like @mofirouz said, flatbuffers and protobuf need c bindings. Now I am refactoring our code to let flatbuffers work with our project.

Thanks @sean & @mofirouz for reply.
