0

Wondering if it where posible to create a hooking system in .Net with LuaInterface This system would be like Garry's Mod

Hook.Add("HookName", "CustomName", Function()
    print("Called every time HookName is called) 
end

I am dead in my tracks with trying to figure out how this would work...

Thanks

1 Answers1

0

Quite easy to do, had this same problem myself, you just need this setup

Dim luascript As New Lua()
luascript.RegisterFunction("Print", Me, Me.GetType().GetMethod("Print"))
luascript.DoString("Print('Hello World')")

Which will invoke a method called Print, referenced by GetMethod. The Lua and .NET method names do not have to be the same.

Public Sub Print(text)
    YourAwesomeListBox.Add(text)
End Sub
MineMan287
  • 55
  • 1
  • 6