[LG gnome.1] Lua type %s can't be used for %s

The value you have given for the specified argument is of an unusable Lua type. Possible types are:

A typical case is when you want to pass a pointer to a location where the library function will place a pointer, i.e. use it as an output parameter. In this case, please use gnome.NIL. If you use nil, this most likely means that you want no output, e.g. for a GError** parameter.


[LG gnome.2] Not a C function, but a %s.

A Lua value should contain a closure for a library function, but that value isn't even a C function.


[LG gnome.3] Invalid closure.

A Lua value should contain a closure for a library function. It is a C function, but not the wrapper used for all closures. Please provide another function. You might want to create a closure for the function, see the code example for message 5.


[LG gnome.4] Invalid closure (upvalue 1 not a userdata)

This is actually an interal error that "should not" happen. The inspected closure uses the correct C function (lg_call_wrapper), but its first upvalue is not a userdata, which would contain the function info structure. Please inspect this situation with a debugger and tell the author about this problem.


[LG gnome.5] Lua functions not allowed, use a closure.

It is possible to override virtual functions in structures, which are most likely interfaces. The pointer to store there must point to a C function, not a Lua function. Therefore, you can either use a library function, or a closure for a Lua function, but not a Lua function directly. It is not possible either to automatically generate a closure, as it could be garbage collected anytime.

To remedy this, use code like the following, and make sure that the variable holding the closure is not garbage collected, i.e. is not a local variable:

cl = gnome.closure(my_function) obj.virt_func = cl


[LG gnome.6] Invalid type %s for function pointer.

To override a virtual function, you have to provide either a library function, a closure for a Lua function or nil. Any other type will lead to this error.


[LG gnome.7] Value must be a closure

You are trying to use an invalid value for a function pointer, which may be an argument to a library function or to set a structure element which is also a function pointer.


[LG gnome.8] Closure used with different signature

Function pointer arguments and function pointer elements of structures have a type with an associated function signature. They can be set to a value which must be a function pointer with the same signature. In case of mismatch, this error is raised.


[LG gnome.9] Function signature mismatch: %s vs %s

When you set a function pointer to a C function, the signature must match, i.e. the function must have exactly the argument list as the function pointer specifies.

If the difference is small enough that the call should work, like a const versus a non-const argument, or unsigned versus signed, then you can write a glue function in Lua like this (not tested):

cl = gnome.closure(function(...) return glib.some_func(...) end) obj.virt_func = cl


[LG gnome.10] Access to attribute of size %d not supported.

The maximum size of a value that can be read by that function is the width of a long, i.e. 32 or 64 bit. Please file a bug report if you think that the variable access you tried should work.


[LG gnome.11] Can't convert Lua type %s to char

The following types can be converted to an (unsigned) char:

Any other Lua type will not work.


[LG gnome.12] Can't convert Lua type %s to enum

An ENUM value is expected, which can be satisfied by one of the following Lua types:


[LG gnome.13] Arg %d enum (type %s) given as number\n

If you provide an integer to fill an ENUM, this warning is printed. In many cases, you can use a constant, e.g. use gtk.WINDOW_TOPLEVEL instead of 0.


[LG gnome.14] Arg %d enum expects type %s, given %s\n

An ENUM variable or argument should be set to a given value, which is an ENUM of a different type. For example, you can't use gtk.JUSTIFY_LEFT as an argument for the window type of the function gtk_window_new, even though it has the same numerical value as gtk.WINDOW_TOPLEVEL.


[LG gnome.15] Arg #%d type %s not supported, replaced by NULL\n

A generic pointer should be set; currently, only nil is supported. Should you need this please write the author about this problem.


[LG gnome.16] Arg %d: Unhandled vararg type %s\n

A library function with variadic arguments is given a Lua type which cannot be converted. Currently, only functions cannot be passed this way, but I'm not aware of an instance where this might be required.


[LG gnome.17] Return value of arg %d (void*) discarded.\n

Only displayed with the runtime flag return is enabled, this message indicates that a void* argument that is supposed to be an output argument (i.e., return something to the caller) wasn't used. If you call a function and don't get a return value you expect, please tell the author about this situation.


[LG gnome.18] Argument %d (type %s) has no ffi type.\n

A "should-not-happen" error, the argument for a function to be called is of a known type, but LuaGnome doesn't have a FFI type stored for it. This means that the fundamental type, like integer or char* is not known, and therefore the call using the FFI library (foreign function interface) is not possible. Please file a bug report.


[LG gnome.19] More arguments expected -> nil used\n

The function to be called expects more arguments. LuaGnome substitutes nil for the missing argument and tries to convert that to the required data type, which may fail and cause an error.


[LG gnome.20] lua2ffi changed the stack\n

All internal functions that convert Lua values to FFI values must not change the Lua stack. Unexpectedly this happened (and was corrected), but this case should be examined and fixed. To do this, compile LuaGnome with debug symbols, then set a breakpoint at this location and run your program using the command lua --args gnome program.lua. The local variable idx then specifies which lua2ffi function was called. Please file a bug report.


[LG gnome.21] Argument %d (type %s) not handled\n

The specified argument is of a type that can't be converted from Lua to FFI. Please file a bug report.


[LG gnome.22] %d superfluous argument%s\n

The function that is about to be called requires less arguments than are provided. Check the function call and remove the given number of arguments.


[LG gnome.23] %s requires %s, given %s

The offending function argument must be of the specified type; the variable given cannot be converted to it. Unless a GValue is to be filled, only nil or a userdata providing an object of the expected type (or a derived type) are acceptable.