(odin) reflection tests
This commit is contained in:
1 parent
58c8b518c8
commit
d9ec57037d
1 file changed
+10
-5
+10
-5
@@ -3,13 +3,18 @@ package test_project
|
||||
import "core:os"
|
||||
import "core:fmt"
|
||||
import "core:math"
|
||||
import "core:reflect"
|
||||
|
||||
test_t :: struct
|
||||
{
|
||||
x: int `x coordinate and stuff`,
|
||||
y: int `y coordinate you know`
|
||||
}
|
||||
|
||||
main :: proc()
|
||||
{
|
||||
test: string = "heloo";
|
||||
length: int = len( test );
|
||||
digits: int = int( math.log10( f32( length ) ) );
|
||||
tags := reflect.struct_field_tags( test_t );
|
||||
|
||||
digits = 3;
|
||||
fmt.printfln( "% *d : %s", digits, length, test );
|
||||
fmt.println( typeid_of( type_of( tags ) ) )
|
||||
fmt.println( tags );
|
||||
}
|
||||
Reference in new issue
Block a user