LuaJIT-ImGui
LuaJIT-ImGui copied to clipboard
Some generic version failures
Generic version is still experimental Its purpose is to detect the overloaded version from arguments Here are some failing cases
from implot
M.PushPlotStyleVarFloat = lib.igPushPlotStyleVarFloat
M.PushPlotStyleVarInt = lib.igPushPlotStyleVarInt
function M.PushPlotStyleVar(a1,a2) -- generic version
if (ffi.istype('float',a2) or type(a2)=='number') then return M.PushPlotStyleVarFloat(a1,a2) end
if (ffi.istype('int',a2) or type(a2)=='number') then return M.PushPlotStyleVarInt(a1,a2) end
print(a1,a2)
error'M.PushPlotStyleVar could not find overloaded'
end
It is imposible to discriminate float from int when it is a Lua number. In this cases generic version cannot be used and overloaded name should be used.
Trying to work a solution, suggestions are welcome.
In order to avoid using overloaded name solution can be giving second argument as CDATA