Skip to content

Commit e8d5a98

Browse files
Improve mvalue function calls
1 parent ca86acd commit e8d5a98

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

api/AltV.Net/Elements/Args/MValue.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public static MValue Create(ICheckpoint checkpoint)
268268
public static MValue Create(Function function)
269269
{
270270
var mValue = Nil;
271-
AltNative.MValueCreate.MValue_CreateFunction(AltNative.MValueCreate.Invoker_Create(function), ref mValue);
271+
AltNative.MValueCreate.MValue_CreateFunction(AltNative.MValueCreate.Invoker_Create(Alt.Module.CSharpNativeResource.NativePointer, function), ref mValue);
272272
return mValue;
273273
}
274274

@@ -393,14 +393,14 @@ public Function GetFunction()
393393
public MValue CallFunction(MValue[] args)
394394
{
395395
var result = Nil;
396-
AltNative.MValueCall.MValue_CallFunction(ref this, args, (ulong) args.Length, ref result);
396+
AltNative.MValueCall.MValue_CallFunction(ref this, args, args.Length, ref result);
397397
return result;
398398
}
399399

400400
public MValue CallFunction(params object[] args)
401401
{
402402
var result = Nil;
403-
AltNative.MValueCall.MValue_CallFunction(ref this, CreateFromObjects(args), (ulong) args.Length,
403+
AltNative.MValueCall.MValue_CallFunction(ref this, CreateFromObjects(args), args.Length,
404404
ref result);
405405
return result;
406406
}

api/AltV.Net/Native/AltV.MValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ internal static extern void MValue_GetDict(ref MValue mValue, ref StringArray ke
9494
internal static class MValueCall
9595
{
9696
[DllImport(DllName, CallingConvention = NativeCallingConvention)]
97-
internal static extern void MValue_CallFunction(ref MValue mValue, MValue[] args, ulong size,
97+
internal static extern void MValue_CallFunction(ref MValue mValue, MValue[] args, int size,
9898
ref MValue result);
9999

100100
[DllImport(DllName, CallingConvention = NativeCallingConvention)]

runtime/src/altv-c-api/mvalue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ void MValue_CreateFunction(CustomInvoker* val, alt::MValue &mValue) {
174174
mValue = alt::MValueFunction(val);
175175
}
176176

177-
void MValue_CallFunction(alt::MValueFunction &mValue, alt::MValue* args, uint64_t size, alt::MValue &result) {
177+
void MValue_CallFunction(alt::MValue* mValue, alt::MValue* args, int32_t size, alt::MValue &result) {
178178
alt::MValueList value;
179179
for (int i = 0; i < size; i++) {
180180
value.Push(args[i]);
181181
}
182-
result = mValue.GetInvoker()->Invoke(value);
182+
result = ((alt::MValueFunction*) mValue)->GetInvoker()->Invoke(value);
183183
}
184184

185185
void MValue_CallFunctionValue(alt::MValueFunction &mValue, alt::MValueList &value, alt::MValue &result) {

runtime/src/altv-c-api/mvalue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ EXPORT void MValue_GetDict(alt::MValue &mValue, alt::Array<alt::String> &keys, a
4444
EXPORT void* MValue_GetEntity(alt::MValue &mValue, alt::IBaseObject::Type &type);
4545
EXPORT MValueFunctionCallback MValue_GetFunction(alt::MValueFunction &mValue);
4646

47-
EXPORT void MValue_CallFunction(alt::MValueFunction &mValue, alt::MValue* args, uint64_t size, alt::MValue &result);
47+
EXPORT void MValue_CallFunction(alt::MValue* mValue, alt::MValue* args, int32_t size, alt::MValue &result);
4848
EXPORT void MValue_CallFunctionValue(alt::MValueFunction &mValue, alt::MValueList &value, alt::MValue &result);
4949
EXPORT void MValue_Dispose(alt::MValue* mValue);
5050

0 commit comments

Comments
 (0)