[NLua] How to call function which has <T> from lua?
I have function in C#, which has <T> parameter. How can I call that function with lua?
8 Replies
What library are you using to interoperative with C# from Lua?
NLua
(forgot to say this somewhere but in title )
oh, sorry
(it's fine, nobody cares about titles, ik)
That might be tricky. See, generic C# functions (having one or more <T> arguments) are created as distinct separate functions at compile time
meaning
A<string>
and A<int>
get turned into two separate functions
in C# you can access a method/class like this at runtime via reflection
so if you can somehow invoke reflection or make a "helper" method that you can call from NLuaDo they have any "usual" renaming which i could call?
after dicussing a bit, looks like this is xy problem lol
because i wanted to check if object has some type from lua
and now i know that i can use
GetType().FullName
, which is a string, so i don't need T
There you go
i can probably just write helper function which converts string to T, and then calls function i needed
Thanks for help!