Difference between revisions of "Mono:Lua:mono invoke method"

From Cheat Engine
Jump to navigation Jump to search
(Examples)
(Examples)
Line 23: Line 23:
 
== Examples ==
 
== Examples ==
  
local methodId = mono_findMethod('', 'PlayerStatsManager', 'TakeDamage')
+
  local methodId = mono_findMethod('', 'PlayerStatsManager', 'TakeDamage')
 
+
  local c = mono_method_getClass(methodId)
local c = mono_method_getClass(methodId)
+
  mono_class_findInstancesOfClass(nil,c,function(m)          -- asynchronously
 
+
    local fl = createFoundList(m)  
mono_class_findInstancesOfClass(nil,c,function(m)          -- asynchronously
+
    fl.initialize()
 
+
    if fl.Count >0 then
  local fl = createFoundList(m)  
+
      InstancesAddress=fl[0]
 
+
      mono_invoke_method('' , methodId , InstancesAddress , {{100}} )
  fl.initialize()
+
    else
 
+
      print('Faild to find Instances')
  if fl.Count >0 then
+
    end
 
+
    fl.destroy()
    InstancesAddress=fl[0]
+
    m.destroy()
 
+
    end
    mono_invoke_method('' , methodId , InstancesAddress , {{100}} )
+
    )
 
 
  else
 
 
 
    print('Faild to find Instances')
 
 
 
  end
 
 
 
  fl.destroy()
 
 
 
  m.destroy()
 
 
 
  end
 
 
 
  )
 

Revision as of 12:45, 17 December 2018

function mono_invoke_method(domain, method, instanseAddress, args): mono_readObject()??




Function Parameters

Parameter Type Description

domain string the domain's name

method string The methods name

instanseAddress integer The address of instanse (?)

args table the arguments



Examples

 local methodId = mono_findMethod(, 'PlayerStatsManager', 'TakeDamage')
 local c = mono_method_getClass(methodId)
 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 , Template:100 )
   else
     print('Faild to find Instances')
   end
   fl.destroy()
   m.destroy()
   end
   )