Mercurial > pub > dyncall > bindings
annotate lua/luadyncall/test/test_intutils.lua @ 54:918dab7a6606
- added callback support (comes with some bigger refactoring)
- allow CPython's Py{CObject,Capsule} to be used as 'p'ointers
author | Tassilo Philipp |
---|---|
date | Tue, 02 Feb 2021 20:42:02 +0100 |
parents | 0cfcc391201f |
children |
rev | line source |
---|---|
0 | 1 require "intutils" |
2 u64 = intutils.u64 | |
3 i64 = intutils.i64 | |
4 local _print = print | |
5 | |
6 local function print(x) | |
7 local mt = getmetatable(x) | |
8 local tostring = mt.__tostring | |
9 if tostring then | |
10 _print( tostring(x) ) | |
11 else | |
12 _print(x) | |
13 end | |
14 end | |
15 | |
16 x = u64("0x00FFFFFFFFFFFF00") | |
17 y = u64("0xCA000000000000FE") | |
18 z = x + y | |
19 print(x) | |
20 print(y) | |
21 print(z) | |
22 | |
23 x = i64("0x00FFFFFFFFFFFF00") | |
24 y = i64("0xCA000000000000FE") | |
25 z = x + y | |
26 print(x) | |
27 print(y) | |
28 print(z) | |
29 |