Lua string functions - How do I do this?
Posted: Sat Apr 16, 2011 2:11 am
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.
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.