Commit 74e7cf7
committed
feat: add pushNumeric, toNumeric and checkNumeric
These functions rely (lightly) on Zig's comptime to minimize some of the
annoying overhead of writing `@intCast` and `@floatCast` all the time by
making those builtins part of the function definition. However, since
those builtins assert in builds with runtime safety enabled, these
functions will crash the program if called with bad Lua input. More
discussion is warranted about the tradeoffs of going this route before
merging.
Resolves #172.1 parent ef5af10 commit 74e7cf7
2 files changed
Lines changed: 48 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2035 | 2035 | | |
2036 | 2036 | | |
2037 | 2037 | | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
2038 | 2050 | | |
2039 | 2051 | | |
2040 | 2052 | | |
| |||
2594 | 2606 | | |
2595 | 2607 | | |
2596 | 2608 | | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
2597 | 2622 | | |
2598 | 2623 | | |
2599 | 2624 | | |
| |||
3342 | 3367 | | |
3343 | 3368 | | |
3344 | 3369 | | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
| 3382 | + | |
3345 | 3383 | | |
3346 | 3384 | | |
3347 | 3385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3055 | 3055 | | |
3056 | 3056 | | |
3057 | 3057 | | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
0 commit comments