The value you have given for the specified argument is of an unusable Lua type. Possible types are:
- string - but only for char**
- lightuserdata - most likely gnome.NIL (see below)
- nil - simply use a NULL pointer
- userdata - not quite sure what this could be used for
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.
A Lua value should contain a closure for a library function, but that value isn't even a C function.
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.
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.
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
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.
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.
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.
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
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.
The following types can be converted to an (unsigned) char:
- a number, which is rounded and truncated to fit a character.
- a boolean; true is 1, while false is 0.
- a string: the ASCII value of first character of the string is used.
Any other Lua type will not work.
An ENUM value is expected, which can be satisfied by one of the following Lua types:
- a number, even though this will cause the runtime warning 13 to be emitted.
- a userdata representing an ENUM or a FLAGS value. This is a typed integer; the type is checked and a mismatch will print the runtime warning 14.
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.
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.
A generic pointer should be set; currently, only nil is supported. Should you need this please write the author about this problem.
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.
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.
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.
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.
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.
The specified argument is of a type that can't be converted from Lua to FFI. Please file a bug report.
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.
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.