Module gnome

Main module for the Lua-Gnome binding.

Functions

local __index (table, key) Look up a name in the given module.
local _init_module_info (L) Add some meta information to the new module.
local default_allocate_object (mi, L, ts, count, flags) If a module doesn't provide a handler to allocate objects, use this default handler.
local get_osname () Give the application an idea of the platform.
local l_destroy (L) When a proxy object should be destroyed right away, without waiting for the garbage collection, this can be used.
local lg_generic_new_array (typename, ...) Allocate a structure, initialize with zero and return it.
lg_get_closure (L, index) The specified Lua value might contain a closure created with the function above, or contain a .
lg_push_closure (L, fi, alloc_fi) Create a closure for a C (library) function.
lg_use_c_closure (ar) A function should be used as a function pointer.
luaopen_gnome (name) Initialize the library, returns a table.


Functions

local __index (table, key)
Look up a name in the given module. This works for functions, like gtk.window_new(), and constants, like gtk.WINDOW_TOPLEVEL. Lua Stack: [1]=gnome [2]=name

Parameters

  • table: The table to look in
  • key: The name of the item to look up

Return values:

  1. Either a userdata (for ENUMs) or a closure (for functions)
In file: src/gnome/init.c line 155
local _init_module_info (L)
Add some meta information to the new module.

Parameters

  • L:
In file: src/gnome/init.c line 439
local default_allocate_object (mi, L, ts, count, flags)
If a module doesn't provide a handler to allocate objects, use this default handler.

Parameters

  • mi:
  • L:
  • ts:
  • count:
  • flags:
In file: src/gnome/init.c line 285
local get_osname ()
Give the application an idea of the platform. Could be used to select path separators and more. I have not found a way to determine this in any other way, so far.

Return values:

  1. The the operating system, e.g. "win32" or "linux".
  2. The CPU, e.g. "i386", "amd64"
In file: src/gnome/init.c line 404
local l_destroy (L)
When a proxy object should be destroyed right away, without waiting for the garbage collection, this can be used.

Parameters

  • L:
In file: src/gnome/init.c line 456
local lg_generic_new_array (typename, ...)
Allocate a structure, initialize with zero and return it. This is NOT intended for objects or structures that have specialized creator functions, like gtk_window_new and such. Use it for simple structures like GtkTreeIter. The object is, as usual, a Lua wrapper in the form of a userdata, containing a pointer to the actual object.

Parameters

  • typename: Type of the structure to allocate
  • ...: array size, or optional additional arguments to the allocator function.

Return values:

  1. The new structure
In file: src/gnome/init.c line 307
lg_get_closure (L, index)
The specified Lua value might contain a closure created with the function above, or contain a . If so, return the func_info embedded in it, otherwise raise an error.

Parameters

  • L:
  • index:
In file: src/gnome/init.c line 127
lg_push_closure (L, fi, alloc_fi)
Create a closure for a C (library) function. The function info may be static, which is for elements of structures, or dynamically created, as is the case for regular library functions. XXX when alloc_fi is not 0, when will this memory be freed again?

Parameters

  • L: Lua State
  • fi: Function Info with name, address and signature
  • alloc_fi: 0=use fi as-is; 1=duplicate the structure; 2=also duplicate the name.
In file: src/gnome/init.c line 51
lg_use_c_closure (ar)
A function should be used as a function pointer. If this is a C closure to a library function, we can use that library function's address directly. This avoids a C closure for a Lua closure, the invocation of which would look like this: FFI closure -> closure_handler -> lg_call_wrapper -> library function.

Parameters

  • ar:

Return value:

1 on success, i.e. ar->arg->p has been set to the C function, or 0 otherwise. In file: src/gnome/init.c line 95
luaopen_gnome (name)
Initialize the library, returns a table. This function is called by Lua when this library is dynamically loaded. Note that the table is also stored as the global "gnome" (by the "require" command), and that is accessed from this library sometimes.

Parameters

  • name: This library's name, i.e. "gnome".
In file: src/gnome/init.c line 566

Valid XHTML 1.0!