public static void pushVar(IntPtr l, object o) { if (o == null) { LuaDLL.lua_pushnil(l); return; } Type t = o.GetType(); LuaState.PushVarDelegate push; LuaState ls = LuaState.get(l); if (ls.tryGetTypePusher(t, out push)) { push(l, o); } else if (t.IsEnum) { pushEnum(l, Convert.ToInt32(o)); } else if (t.IsArray) { pushObject(l, (Array)o); } else { pushObject(l, o); } }