LuaJIT-ImGui icon indicating copy to clipboard operation
LuaJIT-ImGui copied to clipboard

Some generic version failures

Open sonoro1234 opened this issue 4 years ago • 1 comments

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.

sonoro1234 avatar Apr 29 '20 14:04 sonoro1234

In order to avoid using overloaded name solution can be giving second argument as CDATA

sonoro1234 avatar Mar 25 '22 11:03 sonoro1234