Chat freely about anything...

User avatar
By getz53
#49728 Newbie here.

I am using ESPlorer with an ESP8266 ESP-01 hardware module. I have flashed the ESP-01 with recent NodeMCU firmware and I am trying to run a set of LUA code in an init.lua file that has a "require(base64)" statement in it. The "require" statement gives me the error shown below. I have a file with the base64 code module in it. How do I tell ESPlorer where the base64 file is so that the "require" statement works?

Thanks!

> dofile("init");
init:12: module 'base64' not found:
no field package.preload['base64']
no file 'base64.lc'
no file 'base64.lua'
stack traceback:
[C]: in function 'require'
init:12: in main chunk
[C]: in function 'dofile'
stdin:1: in main chunk
User avatar
By marcelstoer
#49744
getz53 wrote:How do I tell ESPlorer where the base64 file is so that the "require" statement works?


It actually tells you...

getz53 wrote:
Code: Select all> dofile("init");
init:12: module 'base64' not found:
   no field package.preload['base64']
   no file 'base64.lc'
   no file 'base64.lua'


You need to save the base64 code, wherever you get that from, to a file 'base64.lua' and tell ESPlorer to send it to your device. Or you can compile that code and save it as 'base64.lc'. An alternative would be to use the firmware's encoder module rather than using a Lua base64 implementation.