static int get_Define(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); EnumDescriptor obj = (EnumDescriptor)o; google.protobuf.EnumDescriptorProto ret = obj.Define; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index Define on a nil value" : e.Message)); } }
private void DumpEnumDescriptor(EnumDescriptorProto field, StringBuilder sb, int level) { AddEnumDescriptorLookup(field); string levelspace = new String('\t', level); sb.AppendLine(levelspace + "enum " + field.name + " {"); foreach (var option in DumpOptions(field.options)) { sb.AppendLine(levelspace + "\toption " + option.Key + " = " + option.Value + ";"); } foreach (EnumValueDescriptorProto enumValue in field.value) { Dictionary<string, string> options = DumpOptions(enumValue.options); string parameters = String.Empty; if (options.Count > 0) { parameters = " [" + String.Join(", ", options.Select(kvp => String.Format("{0} = {1}", kvp.Key, kvp.Value))) + "]"; } sb.AppendLine(levelspace + "\t" + enumValue.name + " = " + enumValue.number + parameters + ";"); } sb.AppendLine(levelspace + "}"); sb.AppendLine(); }
private void AddEnumDescriptorLookup(EnumDescriptorProto enumdesc) { enumLookup[GetDescriptorName(enumdesc.name)] = enumdesc; enumLookupCount[GetDescriptorName(enumdesc.name)] = enumdesc.value.Count; }