Skip to content

Commit

Permalink
Fix class() in BFS and DFS
Browse files Browse the repository at this point in the history
hansonchar committed Jan 14, 2025
1 parent 6ef3690 commit 2dfec22
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions learning-lua/algo/BFS.lua
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ function BFS:iterate()
end

function BFS:class(o)
setmetatable(o, BFS)
BFS.__index = BFS
setmetatable(o, self)
self.__index = self
return o
end

4 changes: 2 additions & 2 deletions learning-lua/algo/DFS.lua
Original file line number Diff line number Diff line change
@@ -41,8 +41,8 @@ function DFS:iterate()
end

function DFS:class(o)
setmetatable(o, DFS)
DFS.__index = DFS
setmetatable(o, self)
self.__index = self
return o
end

0 comments on commit 2dfec22

Please sign in to comment.