Pass os.execute as argument

master
Lars Mueller 2021-07-22 15:22:13 +02:00
parent e75bce938f
commit b22a6e20ed
3 changed files with 15 additions and 22 deletions

View File

@ -1,14 +1,11 @@
local os_execute = ...
local vector, round = modlib.vector, modlib.math.round
local function format_pos(v)
return table.concat(vector.apply(v, function(c) return round(c, 100) end), ", ")
end
local os_execute = os.execute
function set_os_execute(os_exec)
os_execute = os_exec
set_os_execute = nil
end
local defaults = config.defaults
minetest.register_privilege("protection_bypass", {

View File

@ -9,17 +9,17 @@ local function os_execute(command, ...)
end
return os_execute_base(command.." "..table.concat(args, " "))
end
local extend = modlib.mod.extend
extend("conf") -- Load JSON configuration stored in worldpath
extend("closest_color") -- Closest color finder, uses linear search / k-d tree depending on number of colors
extend("texture_reader") -- Texture reader, reads textures, uses Java program
voxelizer.set_os_execute(os_execute) -- Passing insecure os.execute while keeping it local
extend("dithering") -- Error diffusion dithering
extend("obj_reader") -- OBJ reader, reads simple OBJ models
extend("node_map_reader") -- Node map reader, reads minetestmapper-colors.txt like files
extend("main") -- Main : Actual API for placing of models using VoxelManip
extend("chatcommands") -- Chatcommands for making use of the API
voxelizer.set_os_execute(os_execute) -- Passing insecure os.execute while keeping it local
local function load(name, ...)
assert(loadfile(modlib.mod.get_resource(name .. ".lua")))(...)
end
load"conf" -- Load JSON configuration stored in worldpath
load"closest_color" -- Closest color finder, uses linear search / k-d tree depending on number of colors
load("texture_reader", os_execute) -- Texture reader, reads textures, uses Java program
load"dithering" -- Error diffusion dithering
load"obj_reader" -- OBJ reader, reads simple OBJ models
load"node_map_reader" -- Node map reader, reads minetestmapper-colors.txt like files
load"main" -- Main : Actual API for placing of models using VoxelManip
load("chatcommands", os_execute) -- Chatcommands for making use of the API
-- Tests, not intended for production use
--[[minetest.register_on_mods_loaded(function()

View File

@ -1,10 +1,6 @@
local vector = modlib.vector
local os_execute = ...
local os_execute = os.execute
function set_os_execute(os_exec)
os_execute = os_exec
set_os_execute = nil
end
local vector = modlib.vector
function rgba_number_to_table(number)
local b = number % 256