trevordevore / levure

Application development framework for LiveCode
MIT License
32 stars 14 forks source link

Add check for sub-property of app.yml #118

Closed macMikey closed 5 years ago

macMikey commented 5 years ago
key:
   sub-key:

levureAppHasProperty can't check for key.subkey, right?

trevordevore commented 5 years ago

Not currently but I should be able to add that. I’m not able to look at the code right now but I would guess that a variable parameter list would work. I’ll look at it tonight.

macMikey commented 5 years ago

I was trying to think about how to add the syntax. I suppose n parameters could be added to levureAppHasProperty and that would get us n levels deep. Then you would do something like

if levureAppHasProperty "key","subkey"

trevordevore commented 5 years ago
function levureAppHasProperty pProp
  if the paramcount is 1 then
    return pProp is among the keys of sAppA
  else
    local i, tIndexA

    repeat with i = 1 to the paramcount - 1
      put param(i) into tIndexA[i]
    end repeat
    return param(the paramcount) is among the keys of sAppA[tIndexA]
  end if
end levureAppHasProperty
put levureAppHasProperty("preferences filename", "user", "default")
trevordevore commented 5 years ago

I'll commit that to the dev branch.