aboutsummaryrefslogtreecommitdiff
path: root/stdlib/rng.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-29 12:55:14 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-29 12:55:14 -0500
commit4b5e4cd1f21582f5e5fa682ab4e4bff252963468 (patch)
treee8fecb01f444c1d392c09255adba5cf6b312b326 /stdlib/rng.c
parent0b0e0a0a1d41e9574de8dc17c688a4894c5e7f92 (diff)
Change how types handle metamethods
Diffstat (limited to 'stdlib/rng.c')
-rw-r--r--stdlib/rng.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stdlib/rng.c b/stdlib/rng.c
index 357537b6..8104c451 100644
--- a/stdlib/rng.c
+++ b/stdlib/rng.c
@@ -26,11 +26,10 @@ struct RNGState_t {
uint8_t random_bytes[1024];
};
-PUREFUNC static Text_t RNG$as_text(const RNG_t *rng, bool colorize, const TypeInfo_t *type)
+PUREFUNC static Text_t RNG$as_text(const void *rng, bool colorize, const TypeInfo_t*)
{
- (void)type;
if (!rng) return Text("RNG");
- return Text$format(colorize ? "\x1b[34;1mRNG(%p)\x1b[m" : "RNG(%p)", *rng);
+ return Text$format(colorize ? "\x1b[34;1mRNG(%p)\x1b[m" : "RNG(%p)", *(RNG_t**)rng);
}
#define KEYSZ 32
@@ -259,8 +258,9 @@ public Array_t RNG$bytes(RNG_t rng, Int_t count)
public const TypeInfo_t RNG$info = {
.size=sizeof(void*),
.align=__alignof__(void*),
- .tag=CustomInfo,
- .CustomInfo={.as_text=(void*)RNG$as_text},
+ .metamethods={
+ .as_text=RNG$as_text,
+ },
};
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0