trevordevore / levure

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

appHasProperty() and levureAppGet() don't handle multidim array? #148

Closed macMikey closed 5 years ago

macMikey commented 5 years ago

app.yml:

helpers:
  - folder: ./helpers
  - filename: "[[FRAMEWORK]]/helpers/preferences"
  - filename: "[[FRAMEWORK]]/helpers/logger"

levureAppHasProperty("helpers>folder") returns false

levureAppGet("helpers>folder") returns nothing

macMikey commented 5 years ago

The numeric indexes seem to make this harder to handle. Why did you numerically index the array, btw? Was that just a historical artifact?

trevordevore commented 5 years ago

It returns an array. Levure uses numerically indexed arrays throughout as that is how you can have a list of arrays in LiveCode.

LiveCode makes it easy to iterate over a numerically indexed array of arrays using ‘repeat for each element’. The engine will loop through the elements using the correct order.

repeat for each element tElementA in tArrayA

end repeat
trevordevore commented 5 years ago

Sorry, I misread this the first time. - in YAML represents a list. A numerically indexed array is how you represent a list and : represents an associative array. So the syntax created a list of associative arrays. In LiveCode that is represented with a numerically indexed array of arrays.

So the request you are making doesn’t make sense as helpers is not serving as an associative array, it is a list.

macMikey commented 5 years ago

If I do it for filename it also fails.

trevordevore commented 5 years ago

As it should. helpers is a numerically indexed array of arrays. There is no filename key at the root level. Just numerically indexed arrays.

macMikey commented 5 years ago

Sorry, I meant helpers>filename

trevordevore commented 5 years ago

That is how I read what you wrote. There is no filename key at the root of the helpers key.

macMikey commented 5 years ago

then when you're in a list, is the only way to make a subkey to make another list? If I try to make a subkey to an element that begins with a hyphen it doesn't seem to become a subkey.

macMikey commented 5 years ago

belay that. i think i read enough levure code to find what i was looking for.

trevordevore commented 5 years ago

Okay. If you still run into trouble post an example of what you are doing, what you expected to happen, and what is actually happening.