I tried to use lua sandbox https://github.com/kikito/lua-sandbox, but even the cited examples don't work.
If it is possible to do this, how can I do it?
-- at the top of main.lua
local love = love
_G.love = nil
Because the love api is wrapped in a single table, assigning a reference into a local variable and then setting the global to nil should prevent its use in other files.
The linked sandbox library should be able to achieve this, too, you'll just have to correctly pass the environment to use.
Little curious about what the specific reason or use-case might be.