excessive / DOMy

A DOM-like GUI framework for the *awesome* LÖVE framework
Other
32 stars 2 forks source link

Explicit type #3

Closed pablomayobre closed 9 years ago

pablomayobre commented 9 years ago

In the markup you declare the type o each segment or child like this:

{type="header",id="myHeader",
    {type="image",id="HeaderIcon",src="pathToMyImage"}
    ...
}

I think that it may be better to have the type mandatory being the first element:

{"header",id="myHeader",
    {"image",id="HeaderIcon",src="pathToMyImage"}
    ...
}

It looks more like HTML, also you avoid writing type at every node hahaha

karai17 commented 9 years ago

That's an idea. Does Lua allow you to define sequential arrays in an unordered way? Example:

local t = {
  "one", "two",
  three="three",
  "four", "five"
}

for _, v in ipairs(t) do
  print(v) -- one two four five OR one two?
end

If that is consistent, then I could simplify some of the markup for sure.

pablomayobre commented 9 years ago

What you posted is valid as I understood from all the manuals and things I've read

EDIT: I found it here

karai17 commented 9 years ago

Aye, running that code on lua.org's cgi demo produces "one two four five". I may revise the markup file later today and add a note in the readme indicating that the first item in a sequence will always be the object declaration, the second will be a value if a value is expected and if the value is not a table or a function, and the rest onward (that are tables) are child objects.

pablomayobre commented 9 years ago

Well I editted the comment and added a resource that says that it is completely valid... you may want to check it anyway

karai17 commented 9 years ago

Perfect, thanks. I've gone ahead and updated the markup file and added a note to the README.

pablomayobre commented 9 years ago

Shall this be closed and we leave the discussion in issue #4 ?

karai17 commented 9 years ago

Yeah, that makes sense.