I've encountered a bug where vectors and f64 userdata doesn't get saved in the pod format.
This code:
local foo = vec(10, 10) print(tostr(foo), 10, 10, 7) print(pod(foo), 10, 20, 7) print(tostr(unpod(pod(foo))), 10, 30, 7) local bar = userdata("f64", 2) bar.x = 10 bar.y = 10 print(tostr(bar), 10, 50, 7) print(pod(bar), 10, 60, 7) print(tostr(unpod(pod(bar))), 10, 70, 7) |
prints:
(10.00000, 10.00000) userdata("f64",2,"") (0.00000, 0.00000) (10.00000, 10.00000) userdata("f64",2,"") (0.00000, 0.00000) |
You can see that pod() doesn't save the values for the userdata.
!!??
Is running the code in the terminal different to running it in a program?
I wrote some code to display it in a window. It is as follows.
It works as if nothing happened.
function _init() window(200, 120) end function _update() end function _draw() cls() local foo = vec(10, 10) print(tostr(foo), 10, 10, 7) print(pod(foo), 10, 20, 7) print(tostr(unpod(pod(foo))), 10, 30, 7) local bar = userdata("f64", 2) bar.x = 10 bar.y = 10 print(tostr(bar), 10, 50, 7) print(pod(bar), 10, 60, 7) print(tostr(unpod(pod(bar))), 10, 70, 7) end |
1
Oh! I'm on 0.1.0f, I didn't realise there was an update.
EDIT: Yeah, it works now. Oops!
[Please log in to post a comment]