That goes back to my original post, Lua XML isn't working.slime wrote:As others have mentioned, you should probably use a pure Lua solution if you really want XML parsing. http://lua-users.org/wiki/LuaXml
Also, Lua is not an acronym. It's Lua, not LUA.
Love2D and LuaXML
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Love2D and LuaXML
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Love2D and LuaXML
If the requirement is that the data is easily editable in excel, then it shouldn't be very complicated to do something custom in plain lua. The nice thing about excel is that it can't do very complicated stuff - for example big hierarchies of xml nodes etc.
The data on this file (coordinates.xls):
Is transformed by excel into something like this:
It can be longer than that, but it can't get much more complicated. You will not find more nesting than that (I think), or attributes, or anything.
The lua equivalent for that would be:
I usually wouldn't recommend using regular expressions to parse XML, but on this case, since your "input" XML is going to be very limited, I would give them a try. It would probably take between 3 and 10 lines of Lua code to get the transformation done. Your app would be more portable, and you would not have to deal with binaries and the problems they cause.
The data on this file (coordinates.xls):
Code: Select all
| x | y | z |
+---+---+---+
| 1 | 2 | 3 |
| 4 | 5 | 6 |
Code: Select all
<?xml version="1.0" ... ?>
<coordinatesData xmlns:xsi= ... >
<xData>
<x>1</x>
<y>2</y>
<z>3</z>
</xData>
<xData>
<x>4</x>
<y>5</y>
<z>6</z>
</xData>
</coordinatesData>
The lua equivalent for that would be:
Code: Select all
return {
{ x = 1,
y = 2,
z = 3
},
{ x = 4,
y = 5,
z = 6
}
}
When I write def I mean function.
Re: Love2D and LuaXML
I will not take side of any of the sides, but I reckon the advantages of both sides. I also had the same mental debates about future use of XML/Tiled XML maps in my projects.
By kikito's/slime side will be much faster loading/saving info in native ways and "reading" the info isn't so bad as XML and even better sometimes without so many tagging space wasting.
By Leon's side I totally understand the temptation of want to keep things in an universal, well know format that can be read, altered and saved out-of-Love almost anyhere and also without the user need to understand and know LOVE/Lua. However needs a robust XML engine to don't slowdown much I/O of data. If you doing a small scale XML RPG perhaps could work follow your heart but in a large scale could be painful I believe.
Anyway you decide I be glad to see RPG's around.
By kikito's/slime side will be much faster loading/saving info in native ways and "reading" the info isn't so bad as XML and even better sometimes without so many tagging space wasting.
By Leon's side I totally understand the temptation of want to keep things in an universal, well know format that can be read, altered and saved out-of-Love almost anyhere and also without the user need to understand and know LOVE/Lua. However needs a robust XML engine to don't slowdown much I/O of data. If you doing a small scale XML RPG perhaps could work follow your heart but in a large scale could be painful I believe.
Anyway you decide I be glad to see RPG's around.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Love2D and LuaXML
I don't think using Lua is going to be a problem. It is used in many games as a language for scripting, extending and modding. You can even allow modders to write functions. Try doing that in XML.
Help us help you: attach a .love.
Re: Love2D and LuaXML
Hey, found this thread through google after having the same problem as the OP.
I have a project folder containing my main.lua, LuaXML.lua and LuaXML_lib.dll (My main requires LuaXML, which itself requires the dll). However, when I attempt to run the project in LOVE I get the following error:
LuaXml.lua:1: module 'LuaXML_lib' not found
Followed by the "no file <various locations>", among which is ".\LuaXML_lib.dll", which should be the project folder, I would have thought.
Is there something I need to do to include the required dll in the project beyond simply placing it in the project folder? Or does Love have any known compatibility issues with standard Lua modules? The XML parsing code in my main.lua works just fine in Lua sans Love, by the by, and has no problems with require.
Any help / suggestions would be appreciated.
I have a project folder containing my main.lua, LuaXML.lua and LuaXML_lib.dll (My main requires LuaXML, which itself requires the dll). However, when I attempt to run the project in LOVE I get the following error:
LuaXml.lua:1: module 'LuaXML_lib' not found
Followed by the "no file <various locations>", among which is ".\LuaXML_lib.dll", which should be the project folder, I would have thought.
Is there something I need to do to include the required dll in the project beyond simply placing it in the project folder? Or does Love have any known compatibility issues with standard Lua modules? The XML parsing code in my main.lua works just fine in Lua sans Love, by the by, and has no problems with require.
Any help / suggestions would be appreciated.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Google [Bot] and 6 guests