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

Method PushAny

Assets/XLua/Src/ObjectTranslator.cs:1129–1178  ·  view source on GitHub ↗
(RealStatePtr L, object o)

Source from the content-addressed store, hash-verified

1127 }
1128
1129 public void PushAny(RealStatePtr L, object o)
1130 {
1131 if (o == null)
1132 {
1133 LuaAPI.lua_pushnil(L);
1134 return;
1135 }
1136
1137 Type type = o.GetType();
1138 if (type.IsPrimitive())
1139 {
1140 pushPrimitive(L, o);
1141 }
1142 else if (o is string)
1143 {
1144 LuaAPI.lua_pushstring(L, o as string);
1145 }
1146 else if (type == typeof(byte[]))
1147 {
1148 LuaAPI.lua_pushstring(L, o as byte[]);
1149 }
1150 else if (o is decimal)
1151 {
1152 PushDecimal(L, (decimal)o);
1153 }
1154 else if (o is LuaBase)
1155 {
1156 ((LuaBase)o).push(L);
1157 }
1158 else if (o is LuaCSFunction)
1159 {
1160 Push(L, o as LuaCSFunction);
1161 }
1162 else if (o is ValueType)
1163 {
1164 PushCSObject push;
1165 if (custom_push_funcs.TryGetValue(o.GetType(), out push))
1166 {
1167 push(L, o);
1168 }
1169 else
1170 {
1171 Push(L, o);
1172 }
1173 }
1174 else
1175 {
1176 Push(L, o);
1177 }
1178 }
1179
1180 Dictionary<object, int> enumMap = new Dictionary<object, int>();
1181

Callers 15

CallMethod · 0.80
GetConstructorWrapMethod · 0.80
genFieldGetterMethod · 0.80
genItemGetterMethod · 0.80
makeReflectionWrapMethod · 0.80
ReflectionWrapMethod · 0.80
RegisterLazyFuncMethod · 0.80
RegisterObjectMethod · 0.80
BeginClassRegisterMethod · 0.80
SetCSTableMethod · 0.80
LuaFunction.csFile · 0.80
EnumAndFunction · 0.80

Calls 6

lua_pushnilMethod · 0.80
IsPrimitiveMethod · 0.80
lua_pushstringMethod · 0.80
pushMethod · 0.80
TryGetValueMethod · 0.80
pushFunction · 0.70

Tested by

no test coverage detected