Describe the bug

redis-server crashes with message:

PANIC: unprotected error in call to Lua API (Script attempted to access nonexistent global variable 'err')

To reproduce

$ redis-cli -h localhost
localhost:6379> EVAL "return _G" 0
Error: Server closed the connection

Expected behavior

Server just returns error

Additional information

The problem reproduced on version 6.2 and 7.0.4 on x86_64

Comment From: enjoy-binbin

for the record: 6.2.6 is ok (6.2.7 will panic), introduced #10651, calling in a function also will panic

Comment From: MeirShpilraien

@pragus Thanks reporting, already open a PR that will fix it: https://github.com/redis/redis/pull/11032.