mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add reflect.struct_field_value
This commit is contained in:
@@ -449,7 +449,14 @@ struct_field_value_by_name :: proc(a: any, field: string, allow_using := false)
|
|||||||
return nil
|
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)
|
@(require_results)
|
||||||
struct_field_names :: proc(T: typeid) -> []string {
|
struct_field_names :: proc(T: typeid) -> []string {
|
||||||
|
|||||||
Reference in New Issue
Block a user