# Require same module in many scripts (SOLVED)

**URL:** <https://forum.defold.com/t/require-same-module-in-many-scripts-solved/6259>\
**Category:** Questions\
**Created:** [March 13, 2017, 10:30am UTC](https://forum.defold.com/t/require-same-module-in-many-scripts-solved/6259 "2017-03-13T10:30:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgerion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/morgerion/32/6641_2.png) [@morgerion](https://forum.defold.com/u/morgerion)\
**Post date:** [March 13, 2017, 10:30am UTC](https://forum.defold.com/t/require-same-module-in-many-scripts-solved/6259/1 "2017-03-13T10:30:10Z")

</div>

I have module like:

> **local u = {}**  
> **u.table = {“a”, “b”,“c”}**  
> **return u**

in beginning of script “A.script”: **local u = require “u”**  
in init: **modify(u.table)**

and in beginning of script “B.gui\_script”: **local u = require “u”** , and then in some function of B **use(u.table)**

but in use(u) u does not have modifications from script A; do variables ‘u’ inited by require in different scripts point to the same table or not ? (stackoverflow says that in lua it should be the same table, but it seems not the case in defold) When instead of using u in script B I posted message to script A to do what I intented to do in B, it worked as intened (u was modified).

---

<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:** [March 13, 2017, 10:54am UTC](https://forum.defold.com/t/require-same-module-in-many-scripts-solved/6259/2 "2017-03-13T10:54:19Z")

</div>

> [@morgerion](#):
>
> do variables ‘u’ inited by require in different scripts point to the same table or not ?

In your example `u` would be the same table in both script A and script B. Would you mind posting a minimal example (A.script, B.script and the module) so that I can take a look?

---

<div class="post-metadata">

**Author:** ![morgerion](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/morgerion/32/6641_2.png) [@morgerion](https://forum.defold.com/u/morgerion)\
**Post date:** [March 13, 2017, 12:29pm UTC](https://forum.defold.com/t/require-same-module-in-many-scripts-solved/6259/3 "2017-03-13T12:29:18Z")

</div>

Sorry, this bug was gone after rebuild. O\_o
