Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't do require("module").function1() #7963

Open
viindicater opened this issue Sep 6, 2023 · 3 comments
Open

can't do require("module").function1() #7963

viindicater opened this issue Sep 6, 2023 · 3 comments
Labels
bug Something is not working as expected editor Issues related to the Defold editor lua Issues related to the use of Lua

Comments

@viindicater
Copy link

viindicater commented Sep 6, 2023

Describe the bug (REQUIRED)
can't do require("module").function1() , have to declare the require as a variable and then call the function through it, i.e. have to do

local m = require("module")
m.function1()

To Reproduce (REQUIRED)
Steps to reproduce the behavior:

  1. Create or pick a lua script module
  2. Attempt to require() it and call one of its functions directly on the require()
  3. See error

Expected behavior (REQUIRED)
The function should be called

Defold version (REQUIRED):

  • Version 1.5.0

Platforms (REQUIRED):

  • Platforms: Windows (Editor)
  • OS: Windows 10

Additional context (OPTIONAL):
Seems to also work if the module is already loaded i.e.

local m = require("module")
require("module").function1()
@viindicater viindicater added the bug Something is not working as expected label Sep 6, 2023
@britzl britzl added lua Issues related to the use of Lua pipeline Issue related to the asset build pipeline labels Sep 6, 2023
@britzl
Copy link
Contributor

britzl commented Sep 6, 2023

This is surprising. I thought this would work. We'll look into it.

@AGulev
Copy link
Contributor

AGulev commented Sep 6, 2023

@britzl hmm, I'll take a look into it later this week

@AGulev AGulev added the editor Issues related to the Defold editor label Sep 7, 2023
@AGulev
Copy link
Contributor

AGulev commented Sep 7, 2023

Ok, I got it. It's in the editor. bob.jar is fine (when you bundle project)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working as expected editor Issues related to the Defold editor lua Issues related to the use of Lua
Projects
None yet
Development

No branches or pull requests

3 participants