altered the way callbacks work and finished tape
This commit is contained in:
parent
d2a648f7d9
commit
4f622815fd
@ -1,4 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
set savefolder=savedata
|
||||||
|
if not exist %savefolder% mkdir %savefolder%
|
||||||
|
set saveloc=%cd%\%savefolder%\
|
||||||
cd "sim"
|
cd "sim"
|
||||||
luajit "main.lua"
|
luajit "main.lua" %saveloc%
|
||||||
pause
|
pause
|
13
sim/main.lua
13
sim/main.lua
@ -1,9 +1,15 @@
|
|||||||
|
|
||||||
|
OPT_SAVE_DIR = arg[1] or error("must specify save location")
|
||||||
|
OPT_SAVE_DIR = OPT_SAVE_DIR:gsub("\\$", "").."\\"
|
||||||
|
print("Save location set to \""..OPT_SAVE_DIR.."\"")
|
||||||
|
|
||||||
dofile("simulation.lua")
|
dofile("simulation.lua")
|
||||||
dofile("group.lua")
|
dofile("group.lua")
|
||||||
dofile("wire.lua")
|
dofile("wire.lua")
|
||||||
dofile("gatedef.lua")
|
dofile("gatedef.lua")
|
||||||
dofile("gate.lua")
|
dofile("gate.lua")
|
||||||
dofile("port.lua")
|
dofile("port.lua")
|
||||||
|
dofile("save.lua")
|
||||||
|
|
||||||
OPT_TICK_ENABLED = true
|
OPT_TICK_ENABLED = true
|
||||||
OPT_TICK_TIME = 0
|
OPT_TICK_TIME = 0
|
||||||
@ -108,6 +114,8 @@ while 1 do
|
|||||||
local data = {}
|
local data = {}
|
||||||
local i = 1
|
local i = 1
|
||||||
line = line:gsub(";;", "; ;")
|
line = line:gsub(";;", "; ;")
|
||||||
|
line = line:gsub(";$", "; ")
|
||||||
|
|
||||||
for str in string.gmatch(line, "([^;]+)") do
|
for str in string.gmatch(line, "([^;]+)") do
|
||||||
data[i] = str or ""
|
data[i] = str or ""
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -264,6 +272,11 @@ while 1 do
|
|||||||
sim:queuegateinput(gate, argv)
|
sim:queuegateinput(gate, argv)
|
||||||
|
|
||||||
i = i+2+argc
|
i = i+2+argc
|
||||||
|
elseif data[i] == "SAVE" then
|
||||||
|
print("saving all data")
|
||||||
|
logicsave()
|
||||||
|
else
|
||||||
|
print("invalid data "..data[i])
|
||||||
end
|
end
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
@ -65,3 +65,4 @@ function tobitstring(num, len)
|
|||||||
|
|
||||||
return bitstring
|
return bitstring
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user