added io library isolation so logic functions cant access the io functions

This commit is contained in:
Redo
2020-07-04 02:02:41 -05:00
parent f1013a2356
commit 94bb85c31d
4 changed files with 34 additions and 9 deletions

View File

@@ -1,8 +1,14 @@
OPT_SAVE_DIR = arg[1] or error("must specify save location")
OPT_SAVE_DIR = OPT_SAVE_DIR:gsub("\\$", "").."\\"
OPT_SAVE_DIR = OPT_SAVE_DIR:gsub("\\", "/")
OPT_SAVE_DIR = OPT_SAVE_DIR:gsub("/$", "")
print("Save location set to \""..OPT_SAVE_DIR.."\"")
local socket = require("socket")
dofile("iosafe.lua")
dofile("utility.lua")
dofile("simulation.lua")
dofile("group.lua")
dofile("wire.lua")
@@ -104,7 +110,6 @@ local function acceptclient()
print("Connection from " .. ip .. ":" .. port)
end
local socket = require("socket")
server = assert(socket.bind("*", 25000))
client = nil
@@ -245,10 +250,12 @@ while 1 do
if obj.logictype == 0 then
local numportsi = 0; for k, wire in pairs(obj.group.in_ports ) do numportsi = numportsi+1 end
local numportso = 0; for k, wire in pairs(obj.group.out_ports) do numportso = numportso+1 end
local numwires = 0; for k, wire in pairs(obj.group.wires ) do numwires = numwires +1 end
info = "\\c5WIRE<br>" .. (obj.group.state and "\\c2ON" or "\\c0OFF") .. "\n" ..
"IN PORTS: " ..numportsi.."\n"..
"OUT PORTS: "..numportso
info = "\\c5Net " .. tostring(obj.group):match("table: 0x(.+)"):upper() .. "\n" .. (obj.group.state and "\\c2On" or "\\c0Off") .. "\n" ..
"Wires: "..numwires.."\n"..
"In Ports: " ..numportsi.."\n"..
"Out Ports: "..numportso
;
else
info = "\\c5" .. obj.definition.name .. "<br>"