private string GetLuaType(TypeInfo info) { switch(info.type) { case FieldType.NONE: return "PROTO_NIL"; case FieldType.BOOL: return "PROTO_BLN"; case FieldType.SINT: case FieldType.SINT8: case FieldType.SINT16: case FieldType.SINT32: case FieldType.SINT64: return "PROTO_S64"; case FieldType.UINT: case FieldType.UINT8: case FieldType.UINT16: case FieldType.UINT32: case FieldType.UINT64: return "PROTO_U64"; case FieldType.FLOAT32: return "PROTO_F32"; case FieldType.FLOAT64: return "PROTO_F64"; case FieldType.STRING: case FieldType.BLOB: return "PROTO_STR"; case FieldType.STRUCT: return info.name; //return "PROTO_MSG"; default: return "PROTO_NIL"; } }
public static string GetDataType(TypeInfo info) { switch(info.type) { case FieldType.BOOL: return "bool"; case FieldType.SINT: return "int"; case FieldType.UINT: return "uint"; case FieldType.SINT8: return "sbyte"; case FieldType.UINT8: return "byte"; case FieldType.SINT16: return "short"; case FieldType.UINT16: return "ushort"; case FieldType.SINT32: return "int"; case FieldType.UINT32: return "uint"; case FieldType.SINT64: return "long"; case FieldType.UINT64: return "ulong"; case FieldType.FLOAT32: return "float"; case FieldType.FLOAT64: return "double"; case FieldType.STRING: return "string"; case FieldType.BLOB: return "string"; case FieldType.STRUCT: return info.name; default: return ""; } }
string GetTypeName(TypeInfo info) { switch(info.type) { case FieldType.BOOL: return "pt_bool"; case FieldType.SINT: return "pt_s32"; case FieldType.UINT: return "pt_u32"; case FieldType.SINT8: return "pt_s8"; case FieldType.SINT16: return "pt_s16"; case FieldType.SINT32: return "pt_s32"; case FieldType.SINT64: return "pt_s64"; case FieldType.UINT8: return "pt_u8"; case FieldType.UINT16: return "pt_u16"; case FieldType.UINT32: return "pt_u32"; case FieldType.UINT64: return "pt_u64"; case FieldType.FLOAT32: return "pt_f32"; case FieldType.FLOAT64: return "pt_f64"; case FieldType.STRING: return "pt_str"; case FieldType.BLOB: return "pt_str"; case FieldType.STRUCT: return info.name; default: return ""; } }