diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-02 10:18:37 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-02 10:18:37 +0200 |
| commit | 84889233bfec4ad11ee1160fe63acbbbba7275e7 (patch) | |
| tree | 236643b48bbc1a31f26a70d702a7e3f6b93b723f /tests | |
| parent | 8e64f794f08cb3e4f930df5bb17c3a7061516cca (diff) | |
| download | lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.tar.gz lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.tar.bz2 lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.zip | |
Progressively applying the coding rules
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/manual_register.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/manual_register.lua b/tests/manual_register.lua index b868bb9..23b33c1 100644 --- a/tests/manual_register.lua +++ b/tests/manual_register.lua | |||
| @@ -7,11 +7,11 @@ local RequireAModuleThatExportsGlobalFunctions = function() | |||
| 7 | -- make one of these a global | 7 | -- make one of these a global |
| 8 | GlobalFunc = lfs.attributes | 8 | GlobalFunc = lfs.attributes |
| 9 | -- we need to register it so that it is transferable | 9 | -- we need to register it so that it is transferable |
| 10 | local lanes = require "lanes" | ||
| 10 | if register_func then | 11 | if register_func then |
| 11 | local lanes = require "lanes" | ||
| 12 | lanes.register( "GlobalFunc", GlobalFunc) | 12 | lanes.register( "GlobalFunc", GlobalFunc) |
| 13 | end | 13 | end |
| 14 | print "RequireAModuleThatExportsGlobalFunctions done" | 14 | print("RequireAModuleThatExportsGlobalFunctions done:", lanes.nameof(GlobalFunc)) |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | 17 | ||
| @@ -25,11 +25,13 @@ local GlobalFuncUpval = GlobalFunc | |||
| 25 | -- a lane that makes use of the above global | 25 | -- a lane that makes use of the above global |
| 26 | local f = function() | 26 | local f = function() |
| 27 | GlobalFuncUpval("foo") | 27 | GlobalFuncUpval("foo") |
| 28 | print "f done" | 28 | print("f done:", lanes.nameof(GlobalFuncUpval)) |
| 29 | return 33 | ||
| 29 | end | 30 | end |
| 30 | 31 | ||
| 31 | 32 | ||
| 32 | local g = lanes.gen( "*", f) | 33 | local g = lanes.gen( "*", f) |
| 33 | 34 | ||
| 34 | -- generate a lane, this will transfer f, which pulls GlobalFunc. | 35 | -- generate a lane, this will transfer f, which pulls GlobalFunc. |
| 35 | local h = g() \ No newline at end of file | 36 | local h = g() |
| 37 | assert(h[1] == 33) | ||
