Love2D and LuaXML

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Leon
Prole
Posts: 5
Joined: Wed Nov 23, 2011 4:58 am

Love2D and LuaXML

Post by Leon »

Hey Guys,

New to Love2d and LUA, but things are going swimingly. Currently I am trying to work how I can use LuaXML with Love2D as attempts to use it are throwing errors up in Love.

Normally you would add the LuaXML.lua file and LuaXML_lib to your project folder and then just load it via require 'luaXML' but everytime I do this it say it is missing LuaXML, LuaXML_lib and then a bunch of other stuff.

Is LuaXML meant to be installed somewhere? Or is something else wrong.

For those who don't know what LuaXML is see here.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Love2D and LuaXML

Post by miko »

Leon wrote:Hey Guys,

New to Love2d and LUA, but things are going swimingly. Currently I am trying to work how I can use LuaXML with Love2D as attempts to use it are throwing errors up in Love.
What errors exactly?
Anyways, I would recommend plain lua XML parser, because when you use binary compiled module, your program is no longer multiplatform, and you risk the binary compatibility issue (it depends on which compiler was used to compile love2d and *.dll).
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Love2D and LuaXML

Post by kikito »

Hi Leon,

Why do you need to parse XML in the first place?
When I write def I mean function.
Leon
Prole
Posts: 5
Joined: Wed Nov 23, 2011 4:58 am

Re: Love2D and LuaXML

Post by Leon »

kikito wrote:Hi Leon,

Why do you need to parse XML in the first place?
Storing data in a easily editable file, for the purpose of future modifications. Thh idea is to make it so I could easily put together new spells through the use of XML files which are then read by the parser and put it in a LUA Table.

Heres a image of the error I get:

Image
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Love2D and LuaXML

Post by slime »

Why not use pure Lua files which just have a table inside them, and then loadstring or love.filesystem.load that?
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Love2D and LuaXML

Post by nevon »

Leon wrote:
kikito wrote:Hi Leon,

Why do you need to parse XML in the first place?
Storing data in a easily editable file, for the purpose of future modifications. Thh idea is to make it so I could easily put together new spells through the use of XML files which are then read by the parser and put it in a LUA Table.
Lua is excellent for that. Just store the information as Lua tables.
Leon
Prole
Posts: 5
Joined: Wed Nov 23, 2011 4:58 am

Re: Love2D and LuaXML

Post by Leon »

slime wrote:Why not use pure Lua files which just have a table inside them, and then loadstring or love.filesystem.load that?
Because I want end users to be able to stuff just as easy as me. Not everyone knows how to use Lua while a XML table is easy to just look at and edit.
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Love2D and LuaXML

Post by slime »

Personally I find

Code: Select all

{
	name = "bolt",
	type = "Energy",
	damage = 50,
	speed = 800,
	drain = 8,
	timeout = 1,
	mass = 0.1,
	cooldown = 0.2,
	ammo = false,
	autoaim = false,
	color = {64, 192, 255},
}
much, much easier to read than an XML file.
Leon
Prole
Posts: 5
Joined: Wed Nov 23, 2011 4:58 am

Re: Love2D and LuaXML

Post by Leon »

slime wrote:Personally I find

Code: Select all

{
	name = "bolt",
	type = "Energy",
	damage = 50,
	speed = 800,
	drain = 8,
	timeout = 1,
	mass = 0.1,
	cooldown = 0.2,
	ammo = false,
	autoaim = false,
	color = {64, 192, 255},
}
much, much easier to read than an XML file.
Editing XML files in EXCEL or the open office alternative is easy and nice to do. I know I can do it with LUA, I want to do it with XML. Also I want to do it the other way around as-well, store LUA tables in a XML file.
User avatar
slime
Solid Snayke
Posts: 3144
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Love2D and LuaXML

Post by slime »

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.
I used JAVASCRIPT and PYTHON the other day, but I like the LUA language more. ;)
Last edited by slime on Wed Nov 23, 2011 5:38 pm, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests