Closed tversteeg closed 4 years ago
First create a callback as
local cbt = ffi.cast("ImGuiInputTextCallback",function(aa)
print("Hi",aa)
return 0
end)
and use cbt as callback. If not doing this you create a new callback each time
Thanks for the quick reply.
When I do this I get a bad callback
error.
If I do print(cbt)
I do get:
cdata<int (*)()>: 0x....
Do you know why it doesn't work?
look for bad callback
at http://luajit.org/ext_ffi_semantics.html
may be you need to use jit.off (not in my test)
with your call, also this is generated :
bad argument #2 to 'igInputText' (cannot convert 'string' to 'char *')
Turning of JIT with jit.off()
seems to work, what I also found out in the meantime is that the following also works:
ffi.cast("int (__stdcall *)(ImGuiInputTextCallbackData*)", ..
with your call, also this is generated :
bad argument #2 to 'igInputText' (cannot convert 'string' to 'char *')
This is true, it was just example code because I wrapped it in my own functions but that's too verbose for this example.
solved
When I use the following code I get
too many callbacks
as an error after a while:What is the proper way to pass callbacks to
InputText
?