[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about using Lua for defining GUIs
- From: Daniel Heck <dheck@...>
- Date: Fri, 10 Jan 2003 19:55:58 +0100
pixellent@stodge.net wrote:
> [...]
> 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?
Make 'CreateComponent' a Lua function that parsed its arguments and
calls a corresponding C function. In you example that would be
something like
function CreateComponent(t)
local parent = GetComponent(t.parent)
...
local c = C_CreateClockComponent(t.parent, t.name, ...)
end
and in C
Component *
C_CreateClockComponent(Component *parent, char *name /* ... */)
{
/* ... */
}
Cheers,
Daniel