-
-
Save rubenwardy/6968b70a3853a3036d69 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- stuff | |
def = { | |
c = {"blah","blah2"} | |
} | |
-- comp | |
blah = { | |
depends = {"blah3"} | |
} | |
-- dependancy tree checker | |
yamm.validate = { | |
c = function (def) | |
for i=1,#def.c do | |
print("Looking for dependancies to "..def.c[i]) | |
local cur_type = yamm.types[def.c[i]] | |
if cur_type and yamm.types[def.c[i]].depends then | |
-- check component dependancies | |
for a=1,#cur_type.depends do | |
local cur_dep = cur_type.depends[a] | |
print("--> "..cur_dep) | |
if not yamm.validate.find_in_def(def,cur_dep) then | |
print(" > added") | |
table.insert(def.c,cur_dep) | |
end | |
end | |
end | |
end | |
end, | |
find_in_def = function(def,find) | |
for i=1,#def.c do | |
if def.c[i] == find then | |
print("found "..find.." at "..i) | |
return i | |
end | |
end | |
return false | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment