Reading lua from a file?

So if I made a ton of folders, then set out the lua files like:

local GameType = {}
GameType.Name = "Survival"

How would I read the lua file and be able to read the specific parts like the GameType.Name? Something similar to what Exho did with gPhone apps.

If you’re wanting to make a plugin system I would say the easiest way is to use file.Find to include any lua files found in a directory then in those files modify a table. I can’t really put it into words too well but here’s an old dead project I started that has a decent plugin system.

The jist of it is to find all the files in a plugins directory, create a global table and then incude the plugin, the plugin will then modify that global table then return. After the plugin is done modifying the table you save the table to another table with some metadata to identify the plugins functions. Then keep doing that for all plugins found in the directory.

Hmm, I see what you mean. Not exactly going for an entire plugin system. Maybe another example?

Hrm, what specifically are you trying to do? There’s probably a much better way to go about it than reading the lua file directly and parsing it.

Making different gametypes. As in lots of mini games that can be selected and played. Wanted to do them this way since I thought it would be easier.

EDIT: Nevermind, took a look at CompileFile and it actually sorted all the issues ^^ Thanks