# Using a Lua module in a custom renderer

**URL:** <https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506>\
**Category:** Questions\
**Created:** [April 10, 2016, 6:30am UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506 "2016-04-10T06:30:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FodderMK](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/foddermk/32/778_2.png) [@FodderMK](https://forum.defold.com/u/FodderMK)\
**Post date:** [April 10, 2016, 6:30am UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/1 "2016-04-10T06:30:01Z")

</div>

I would like to store information like `render.get_window_width()` so that scripts outside of the render script can access it. There are a few posts that suggest using a Lua module to hold this information. I’m trying to do this using the following line (which works in my other scripts):

`require "scripts.renderer_helper";`

The error I’m getting back is:

`ERROR:SCRIPT: custom_render/custom.render_script:1: module 'renderer_helper' not found: no file 'renderer_helper'`

How do I load a module in the render script? Or am I going about this the wrong way?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 10, 2016, 6:59am UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/3 "2016-04-10T06:59:16Z")

</div>

Can you double check that you have a file called `renderer_helper.lua` in the folder named `scripts`?

---

<div class="post-metadata">

**Author:** ![FodderMK](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/foddermk/32/778_2.png) [@FodderMK](https://forum.defold.com/u/FodderMK)\
**Post date:** [April 10, 2016, 3:58pm UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/4 "2016-04-10T15:58:01Z")

</div>

Below is a picture of my project structure:

 ![](https://forum-defold-uploads.b-cdn.net/original/1X/594122f3fb52896ca697b2e8205a8eb560ddd583.png)

I know Defold can see the `renderer_helper.lua` script because my `input_test` script is able to load and access the information inside. It seems like something different about the `custom.render` script works with require.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 10, 2016, 7:15pm UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/5 "2016-04-10T19:15:00Z")

</div>

Could you please try and remove the semi-colon at the end of that line?

---

<div class="post-metadata">

**Author:** ![FodderMK](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/foddermk/32/778_2.png) [@FodderMK](https://forum.defold.com/u/FodderMK)\
**Post date:** [April 10, 2016, 7:31pm UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/6 "2016-04-10T19:31:36Z")

</div>

Darn it! My day job is C# coding so semicolons are transparent to me. Thanks for the help with catching that stupid mistake.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 10, 2016, 7:43pm UTC](https://forum.defold.com/t/using-a-lua-module-in-a-custom-renderer/1506/7 "2016-04-10T19:43:19Z")

</div>

It’s actually not stupid. Semi-colons are not forbidden. In Lua you can use semi-colons to have multiple statements on a single line. On the other hand I wouldn’t say that it is encouraged and you will rarely see it used.

During our build process we scan all script files for require() statements to get a list of all \*.lua files to include in the build, and it seems like that semi-colon confused our build tool.
