Add reflect.struct_field_value

This commit is contained in:
gingerBill
2023-03-17 11:47:39 +00:00
parent bfb231fb8a
commit 0b064765c9

View File

@@ -449,7 +449,14 @@ struct_field_value_by_name :: proc(a: any, field: string, allow_using := false)
return nil
}
@(require_results)
struct_field_value :: proc(a: any, field: Struct_Field) -> any {
if a == nil { return nil }
return any {
rawptr(uintptr(a.data) + field.offset),
field.type.id,
}
}
@(require_results)
struct_field_names :: proc(T: typeid) -> []string {