lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm using Lua in a game framework that I'm prototyping and I'd like to try to 
use Lua as a GUI definition language. I'd like to implement something like the 
following, assuming that CreateGUI and CreateComponent are C functions that are 
exported to Lua scripts:

in gui.lua:

	CreateGUI
	{
		name = "Canvas",
		horizontal = "left",
		vertical = "top",
		position = "0 0",
		visible = 1,
		bitmap = "./bitmaps/bitmap.jpg",
		size = "640 480"

		CreateComponent
		{
			type = "ClockComponent",
			name = "Clock",
			horizontal = "left",
			vertical = "top",
			position = "0 0",
			visible = 1,
			size = "100 100"
		}
	}


Now I know that the above doesn't work, but it's what I would like. Now, 
instead I could do:

	CreateGUI
	{
		name = "Canvas",
		horizontal = "left",
		vertical = "top",
		position = "0 0",
		visible = 1,
		bitmap = "./bitmaps/bitmap.jpg",
		size = "640 480"
	}

	CreateComponent
	{
		type = "ClockComponent",
		parent = "Canvas",
		name = "Clock",
		horizontal = "left",
		vertical = "top",
		position = "0 0",
		visible = 1,
		size = "100 100"
	}

But I haven't found how to parse through this from within C. Are there any 
examples of this somewhere, or could someone give me a few pointers how to walk 
through this in C?

Many thanks