Lua string functions - How do I do this?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
TheKraigose
Prole
Posts: 9
Joined: Tue Apr 12, 2011 5:20 pm
Location: Somewhere that's Hi in the middle, Round at Both Ends!
Contact:

Lua string functions - How do I do this?

Post by TheKraigose »

Okay, I'm kind of stumped on one thing - Lua's string functions.

I'm trying to write a parser for my Love2D-based map editor, which has the format as followed:
-- Comment header for no reason.
map[1] = {1, 2, 3}
objmap[1] = {55, 66, 77}

It may look similar... because it's actually an included LUA file that is parsed by my game and generates levels based on the tables inside.

I can write the tables no problem using Lua's built-in writing functions. It's the Opening of the files that's stumped me.

I've tried including (via require()) and heavy coding, but unfortunately I know that love2d's file system has limited access (which is mostly a good thing!) and thus that didn't work.

I'm trying to write this parser so I can work on levels without having to work on the levels in one-go.

Any pointers on how to split up what's in the curly braces? I've looked at the online lua guide and it... was admittedly hard to understand. then maybe part of it is the fact I've been up a very long time and need rest.

Whatever the reason, I humbly seek advice from anyone who has any idea on how to solve this issue.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Lua string functions - How do I do this?

Post by Robin »

I'm not sure what exactly the question is?
Help us help you: attach a .love.
User avatar
TheKraigose
Prole
Posts: 9
Joined: Tue Apr 12, 2011 5:20 pm
Location: Somewhere that's Hi in the middle, Round at Both Ends!
Contact:

Re: Lua string functions - How do I do this?

Post by TheKraigose »

Robin wrote:I'm not sure what exactly the question is?
I actually figured it out.

My question though was "how do you do strings and file handling in Lua". Sorry about earlier DX
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Lua string functions - How do I do this?

Post by Taehl »

Maybe you want to use TSerial for this?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests