maximegmd / CyberEngineTweaks

Cyberpunk 2077 tweaks, hacks and scripting framework
MIT License
4.48k stars 285 forks source link

CET does not support native `Variant` conversion when passing arguments #960

Open Mozz3d opened 1 month ago

Mozz3d commented 1 month ago

Operating system: Windows 10 Game version: 2.12a CET version: 1.32.3 GPU: RTX 3060

Description

CET throws an error when attempting to call a native function that expects a Variant as an argument.

Expected behaviour

CET should convert any arguments to a Variant (for functions that expect it as an argument) so that the native function may handle it.

Reproduction

C++

void VariantTest(const Red::Variant& aVariant)
{
    auto type = aVariant.GetType();
}
RTTI_FUNCTION(VariantTest);

Lua

registerForEvent('onInit', function() 
    VariantTest(1.0)
end)

[2024-08-10 21:49:27 UTC-04:00] [30852] init.lua:2: Function 'VariantTest' parameter 1 must be Variant.
stack traceback:
    [C]: in function 'VariantTest'
    init.lua:2: in function <init.lua:1>```