(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:os"
|
||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:math"
|
import "core:math"
|
||||||
|
import "core:reflect"
|
||||||
|
|
||||||
|
test_t :: struct
|
||||||
|
{
|
||||||
|
x: int `x coordinate and stuff`,
|
||||||
|
y: int `y coordinate you know`
|
||||||
|
}
|
||||||
|
|
||||||
main :: proc()
|
main :: proc()
|
||||||
{
|
{
|
||||||
test: string = "heloo";
|
tags := reflect.struct_field_tags( test_t );
|
||||||
length: int = len( test );
|
|
||||||
digits: int = int( math.log10( f32( length ) ) );
|
|
||||||
|
|
||||||
digits = 3;
|
fmt.println( typeid_of( type_of( tags ) ) )
|
||||||
fmt.printfln( "% *d : %s", digits, length, test );
|
fmt.println( tags );
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user