File src/gnome/gvalue.c

Functions

local _fill_gvalue_flags (L, gv, luatype, index) The GValue should contain flags.
local _parse_integer (s, len, val) Convert the string of given length to a positive integer.
local _string_to_double (L, index, ok) Conversion of a string to float.
local _to_boolean (L, index) Try to convert the string to a boolean value.
local _to_double (L, index, ok) Get the floating point number from the given Lua value.
local _to_number (L, type, index, ok) Convert the value at the given stack position to a lua_Integer.
lg_gvalue_to_ffi (L, gv, dest, argtype) A GValue should be used to set a ffi parameter, which is not a GValue, but of the type that is contained in the GValue.
lg_gvalue_to_lua (L, gv) A parameter for a callback must be pushed onto the stack, or a return value from Gtk converted to a Lua type.
lg_lua_to_gvalue (L, index, gvalue) Try to convert a value on the Lua stack into a GValue.
lg_lua_to_gvalue_cast (L, index, gv, gtype) Set a GValue from a Lua stack entry, thereby enforcing a specific data type.


Functions

local _fill_gvalue_flags (L, gv, luatype, index)
The GValue should contain flags. The given value may be a number, or a string; in this case split it by "|" and look up each item individually.

Parameters

  • L:
  • gv:
  • luatype:
  • index:
local _parse_integer (s, len, val)
Convert the string of given length to a positive integer.

Parameters

  • s:
  • len:
  • val:

Return value:

0 on error, 1 on success
local _string_to_double (L, index, ok)
Conversion of a string to float. This function doesn't depend on a library function and therefore is immune to locale settings. I found it unreliable to set/reset the locale for every conversion. It sets *ok to 0 on error, or 1 on success.

Parameters

  • L:
  • index:
  • ok:
local _to_boolean (L, index)
Try to convert the string to a boolean value. Recognized strings are "true", "false", "1", "0".

Parameters

  • L: Lua State
  • index: Stack position of the string.

Return value:

0=false, 1=true
local _to_double (L, index, ok)
Get the floating point number from the given Lua value. If it is a string, a conversion has to be done. The decimal point is always ".", disregarding the current locale setting.

Parameters

  • L:
  • index:
  • ok:
local _to_number (L, type, index, ok)
Convert the value at the given stack position to a lua_Integer. Accepts integer, string with an appropriate content.

Parameters

  • L:
  • type:
  • index:
  • ok:
lg_gvalue_to_ffi (L, gv, dest, argtype)
A GValue should be used to set a ffi parameter, which is not a GValue, but of the type that is contained in the GValue.

Parameters

  • L:
  • gv:
  • dest:
  • argtype:
lg_gvalue_to_lua (L, gv)
A parameter for a callback must be pushed onto the stack, or a return value from Gtk converted to a Lua type. A value is always pushed; in the case of error, NIL.

Parameters

  • L: Lua State
  • gv: The GValue to be pushed
lg_lua_to_gvalue (L, index, gvalue)
Try to convert a value on the Lua stack into a GValue. The resulting type of the GValue depends on the Lua type.

Parameters

  • L: Lua State
  • index: Lua stack position of the input value
  • gvalue: Pointer to a GValue structure which must be set to zero (output)

Return value:

The given "gvalue", if it is filled in, or pointer to an existing GValue.
lg_lua_to_gvalue_cast (L, index, gv, gtype)
Set a GValue from a Lua stack entry, thereby enforcing a specific data type. NOTE: the GValue is set; be sure to call g_value_unset or simliar on it to avoid refcounting problems.

Parameters

  • L: Lua State
  • index: Lua stack position of the source value
  • gv: (output) The GValue to be set
  • gtype: The G_TYPE_xxx type that *gv should have

Valid XHTML 1.0!