In Lua, a require statement generally reports failure if there’s a syntax error in the required file. For example, I used “!” in place of “not” and get:
lua
> queue = require "queue"
error loading module 'queue' from file './queue.lua':
./queue.lua:142: unexpected symbol near '!'
stack traceback:
[C]: in ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
>
But, running on an Ezlo, I never see this error in any log. Instead, I see in ha-luad.log:
2022-08-12 15:42:42.027110 ERROR: LuaInterpreter: Couldn't run a Lua code: [string "HUB:epyu_lee.epyu_forward_events/scripts/util..."]:37: attempt to call a nil value (method 'read')
at the point where client tries to use a function in the module that failed to load.
What’s going on?
Is there an easy way to do better?