aboutsummaryrefslogtreecommitdiff
path: root/src/lib/env.lua
blob: fd55444bc28b08a1cdd9447cf34cdd5c236db912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Env = {}

function Env.Sandbox(opts)
	local env = {
		string = string,
		table = table,
		type = type,
		utf8 = utf8,
		pairs = pairs,
		ipairs = ipairs,
		select = select,
		tonumber = tonumber,
		tostring = tostring,
		next = next,
		math = math,
		error = error,
		getmetatable = getmetatable,
	}

	opts = opts or {}

	for key, value in pairs(opts) do
		env[key] = value
	end

	return env
end