Skip to main content
Melhorando título
Fonte Link
Rafael Tavares
  • 5,2mil
  • 11
  • 31
  • 52

Problema quando tento importar meus próprios módulos em Lua (not found) [RESOLVIDO]

No arquivo main.lua:

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora

No arquivo CopyOfmain.lua

local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

captura de tela do projeto

erro:

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Coloquei o script no repl.it (https://replRepl.it/@GustavoGLD/calculadora#calc.lua). Lá também está dando erro

Problema quando tento importar meus próprios módulos em Lua (not found) [RESOLVIDO]

No arquivo main.lua:

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora

No arquivo CopyOfmain.lua

local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

captura de tela do projeto

erro:

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Coloquei o script no repl.it (https://repl.it/@GustavoGLD/calculadora#calc.lua). Lá também está dando erro

Problema quando tento importar meus próprios módulos em Lua (not found)

No arquivo main.lua:

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora

No arquivo CopyOfmain.lua

local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

captura de tela do projeto

erro:

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Coloquei o script no Repl.it. Lá também está dando erro

título editado
Link

Problema quando tento importar meus próprios módulos em Lua (not found) [RESOLVIDO]

removeu 5 caracteres do conteúdo; título editado
Fonte Link
Jefferson Quesado
  • 23,5mil
  • 6
  • 60
  • 158

{iniciante} Problema quando tento importar meus próprios módulos em Lua (not found)

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora
local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora
local calculadora = require("calculadora")

print(calculadora.somar(1, 1))
local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

inserir a descrição da imagem aquicaptura de tela do projeto

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)
Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Observação: Coloquei o script no repl.it (https://repl.it/@GustavoGLD/calculadora#calc.lua) E lá. Lá também está dando erro

{iniciante} Problema quando tento importar meus próprios módulos em Lua (not found)

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora
local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

inserir a descrição da imagem aqui

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Observação: Coloquei o script no repl.it (https://repl.it/@GustavoGLD/calculadora#calc.lua) E lá também está dando erro

Problema quando tento importar meus próprios módulos em Lua (not found)

local calculadora = {
  somar = function(x, y)
    return x + y
  end
}

function calculadora.multiplicar(x, y)
  return x * y
end

return calculadora
local calculadora = require("calculadora")

print(calculadora.somar(1, 1))

captura de tela do projeto

Exception in thread "main" com.naef.jnlua.LuaRuntimeException: ..._64\workspace\criando bilbiotecas\src\CopyOfmain.lua:1: module 'calculadora' not found:
    no field package.preload['calculadora']
    no file '.\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\lua\calculadora\init.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.lua'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.lua'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora.luac'
    no file 'C:\Users\lidio\Downloads\org.eclipse.ldt.product-win32.win32.x86_64\workspace\criando bilbiotecas\src\calculadora\init.luac'
    no file '.\calculadora.dll'
    no file '.\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\calculadora51.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\loadall.dll'
    no file 'C:\Program Files\Java\jre1.8.0_251\bin\clibs\loadall.dll'
    at com.naef.jnlua.LuaState.lua_pcall(Native Method)
    at com.naef.jnlua.LuaState.call(LuaState.java:555)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.run(JNLua51Launcher.java:128)
    at org.eclipse.ldt.support.lua51.internal.interpreter.JNLua51Launcher.main(JNLua51Launcher.java:143)

Coloquei o script no repl.it (https://repl.it/@GustavoGLD/calculadora#calc.lua). Lá também está dando erro

adicionou 121 caracteres ao conteúdo
Fonte Link
Carregando
título editado
Link
Carregando
Fonte Link
Carregando