Skip to content

Commit

Permalink
Add nil check when opening file in todot (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
mchambers authored Apr 4, 2024
1 parent 98c2ff4 commit 1890840
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions statemachine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ end

function machine:todot(filename)
local dotfile = io.open(filename,'w')
assert(dotfile~=nil)
dotfile:write('digraph {\n')
local transition = function(event,from,to)
dotfile:write(string.format('%s -> %s [label=%s];\n',from,to,event))
Expand Down

0 comments on commit 1890840

Please sign in to comment.