forked from minetest-mods/global_exchange
mod security compatibility
This commit is contained in:
parent
22f9f394c1
commit
7db6fb3ca7
@ -1,5 +1,6 @@
|
||||
|
||||
local sql = require("lsqlite3")
|
||||
local insecure_env = ...
|
||||
local sql = insecure_env.require("lsqlite3")
|
||||
local exports = {}
|
||||
|
||||
local init_query = [=[
|
||||
|
11
init.lua
11
init.lua
@ -1,16 +1,19 @@
|
||||
|
||||
local insecure_env = minetest.request_insecure_environment()
|
||||
assert(insecure_env,
|
||||
"global_exchange needs to be trusted to run under mod security.")
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
||||
|
||||
local income = tonumber(minetest.setting_get("citizens_income")) or 10
|
||||
|
||||
local income_interval = 1200
|
||||
|
||||
local income_msg = "You receive your citizen's income (+" .. income .. ")"
|
||||
|
||||
local next_payout = os.time() + income_interval
|
||||
|
||||
local exchange = (dofile(modpath .. "exchange.lua")).open_exchange(
|
||||
minetest.get_worldpath() .. "/global_exchange.db"
|
||||
local exchange =
|
||||
assert(loadfile(modpath .. "exchange.lua"))(insecure_env).open_exchange(
|
||||
minetest.get_worldpath() .. "/global_exchange.db"
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user