MCPcopy Create free account
hub / github.com/Tencent/xLua / ToFunction

Function ToFunction

Assets/XLua/Src/StaticLuaCallbacks.cs:1123–1143  ·  view source on GitHub ↗
(RealStatePtr L)

Source from the content-addressed store, hash-verified

1121 }
1122
1123 [MonoPInvokeCallback(typeof(LuaCSFunction))]
1124 public static int ToFunction(RealStatePtr L)
1125 {
1126 try
1127 {
1128 ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
1129 MethodBase m;
1130 translator.Get(L, 1, out m);
1131 if (m == null)
1132 {
1133 return LuaAPI.luaL_error(L, "ToFunction: #1 argument must be a MethodBase");
1134 }
1135 translator.PushFixCSFunction(L,
1136 new LuaCSFunction(translator.methodWrapsCache._GenMethodWrap(m.DeclaringType, m.Name, new MethodBase[] { m }).Call));
1137 return 1;
1138 }
1139 catch (Exception e)
1140 {
1141 return LuaAPI.luaL_error(L, "c# exception in ToFunction: " + e);
1142 }
1143 }
1144
1145 [MonoPInvokeCallback(typeof(LuaCSFunction))]
1146 public static int GenericMethodWraper(RealStatePtr L)

Callers

nothing calls this directly

Calls 5

FindMethod · 0.80
luaL_errorMethod · 0.80
PushFixCSFunctionMethod · 0.80
_GenMethodWrapMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected