Mono:Lua:mono invoke method
function mono_invoke_method(domain, method, instanseAddress, args): mono_readObject()??
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| domain | string | The namespace of the method |
| methodId | integer | The method's id |
| instanseAddress | integer | The address of instanse |
| args | table | The arguments |
Examples
local methodId = mono_findMethod('', 'PlayerStatsManager', 'TakeDamage')
local c = mono_method_getClass(methodId)
local params = mono_method_get_parameters(methodId)
local args = {}
for i=1, #params.parameters do
args[i]={}
args[i].type=monoTypeToVartypeLookup[params.parameters[i].type]
end
args[1].value=100.0
mono_class_findInstancesOfClass(nil,c,function(m) -- asynchronously
local fl = createFoundList(m)
fl.initialize()
if fl.Count >0 then
InstancesAddress=fl[0]
mono_invoke_method('' , methodId , InstancesAddress ,args)
else
print('Faild to find Instances')
end
fl.destroy()
m.destroy()
end
)