Skip to content

require returns chunk name/string instead of require'd contents #567

@cheesycod

Description

@cheesycod

Not sure if its my implementation of require trait thats at fault here but require seems to be returning the chunk name string instead of the loaded module in some cases:

e.g:

abc.luau of:

b = require "./c"
return b

c.luau of

return {a = function() end}

init.luau of

a = require"./c"
print(a)

For some reason, this prints the string init.luau (chunk name) for me sometimes instead of the require'd table which is weird as my load function does in fact return the LuaValue correctly.

As another oddity, the require works when each require is executed as individual calls (e.g. in a REPL), but not when the whole file is executed at the same time (there, the chunkname is returned instead of the require'd data)

For more context (if it helps), im loading everything using lua.create_thread followed by thread.resume and in my require, im using normal/standard lua.load. The lua.load call works as expected and prints out the table when I added a print statement but the returned value that the caller recieved (in lua) was the chunk name string of the caller itself

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions