Currently working of functions. Right now external hooking are not working. Some times they work great, other times it is hilighy glitched. Internal functions work as expected and really well now. However when called outside things tend to go wrong
49 lines
1.0 KiB
Lua
49 lines
1.0 KiB
Lua
package.path="?/init.lua;lua/?/init.lua;lua/?.lua;"..package.path
|
|
local bin = require("bin")
|
|
local multi = require("multi")
|
|
require("parseManager")
|
|
require("multi")
|
|
test=parseManager:compileToFile("test.dms","test.dmsc")--load("StoryTest/init.dms")
|
|
--~ test = parseManager:loadCompiled("test.dmsc")
|
|
print(test:dump())
|
|
test:define{
|
|
external=function(self)
|
|
return multi
|
|
end
|
|
}
|
|
t=test:next()
|
|
while t do
|
|
if t.Type=="text" then
|
|
io.write(t.text)
|
|
io.read()
|
|
t=test:next()
|
|
elseif t.Type=="condition" then
|
|
t=test:next()
|
|
elseif t.Type=="assignment" then
|
|
t=test:next()
|
|
elseif t.Type=="label" then
|
|
t=test:next()
|
|
elseif t.Type=="method" then
|
|
t=test:next()
|
|
elseif t.Type=="choice" then
|
|
print(t.prompt)
|
|
for i=1,#t[1] do
|
|
print(i..". "..t[1][i])
|
|
end
|
|
io.write("Choose#: ")
|
|
cm=tonumber(io.read())
|
|
t=test:next(nil,cm)
|
|
elseif t.Type=="end" then
|
|
if t.text=="leaking" then
|
|
t=test:next()
|
|
else
|
|
os.exit()
|
|
end
|
|
elseif t.Type=="error" then
|
|
error(t.text)
|
|
else
|
|
t=test:next()
|
|
end
|
|
end
|
|
multi:mainloop()
|