Lua / Love2d: Error when trying to give require.Tree("code") : Attempt to index global 'require' (a Function value)

Asked

Viewed 29 times

0

Error when trying to give require.Tree("code") : Attempt to index global 'require' (a Function value)

function love.load()
    lib = require.tree("code")
end

being code a folder with files . moon inside

1 answer

1

Hello, good night! From what I understand, you are trying to import a library in the code, correct? Geralmete do it as follows:

function love.load()
    lib = require "nome da pasta ou arquivo"
end

an example with a physics library that I use a lot:

function love.load()
    HC = require "libs/HC"
end

So it could possibly be ". Tree" after "require". Try to check this, and pass me any doubt or result.

I hope I’ve helped.

Bons Códigos :)

ASS.: Marcosdev

Browser other questions tagged

You are not signed in. Login or sign up in order to post.