Lua code pretty much always ends up tightly coupled to the embedding environment and the API exposed by it. Running a bare lua script against an unmodified interpreter supplied by the OS is just not the normal use case, though certainly possible.
So it's as portable as all lua code, which is up to you but there's rarely a reason to prioritize that too highly. For example the two kinds of lua I've done professionally are web servers and industrial automation. What does it even mean for code to be "portable" between those two? A web server doesn't have a motor and so doesn't expose functions to control one. A conveyor belt doesn't handle http requests so has no functions to send one.
You can definitely come up with library code-type functionality that you'd want in both, and if you write it carefully not to depend on anything outside of the core lua implementation it will run on both. Nothing special about redbean here among the many many other niche uses of lua.