Make table "love" local only to main.lua
Posted: Wed May 04, 2022 12:59 pm
Hi, this is my first question on the forum .
I want to prevent lua files outside main.lua from accessing the love table. Example:
or
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?
I want to prevent lua files outside main.lua from accessing the love table. Example:
Code: Select all
-- main.lua
require "test"
Code: Select all
-- test.lua
love.graphics.setColor(1, 1, 1)
-- return error:
--test.lua:1: attempt to index global 'love' (a nil value)
Code: Select all
-- test.lua
print(love) -- return nil
If it is possible to do this, how can I do it?