How do I access something in a module script from the same module script?

When I try too require the module that I’m currently in, it gives me a recursive error
image

Anyway around this?

Heres an example of what I mean
image

Why would you need to require the module to get it again? You already have the table of the functions in your module so why would you need to require the module again?

Because I cant actually acess the module from within the table I’m working in which is inside of the module script

Just declare a ‘global’ table for the module.

local module = {} --Store the module's contents inside this table.
1 Like

Wouldnt global mean that it doesnt have local in front or are you talking about _G?

module
module={}
local x=1

function module.doThis()
  print("from do this function")
end

--access x using the variable name itself like
print(x) 

--access dothis function by
module.doThis()


local myTable={"cat"}
--access this table using its name

print(myTable[1])

--if its like
local module.myTable={"cat"}

--access using
print(module.myTable[1])

--if its inside 
local module={
name=1
}

--then access using

print(module.name)

return module
1 Like

Oh lets go this worked thanks man!