From 17ca8b54fdc0aa2df875fc7b80def4dd56959d7f Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Thu, 23 May 2024 08:35:40 +0200 Subject: on_state_create receives a string argument, "lane" or "keeper" --- tests/manual_register.lua | 6 +++--- tests/package.lua | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/manual_register.lua b/tests/manual_register.lua index 23b33c1..a8f2098 100644 --- a/tests/manual_register.lua +++ b/tests/manual_register.lua @@ -1,7 +1,7 @@ local register_func = true -local RequireAModuleThatExportsGlobalFunctions = function() +local RequireAModuleThatExportsGlobalFunctions = function(type_) -- grab some module that exports C functions, this is good enough for our purpose local lfs = require "lfs" -- make one of these a global @@ -11,14 +11,14 @@ local RequireAModuleThatExportsGlobalFunctions = function() if register_func then lanes.register( "GlobalFunc", GlobalFunc) end - print("RequireAModuleThatExportsGlobalFunctions done:", lanes.nameof(GlobalFunc)) + print(type_, "RequireAModuleThatExportsGlobalFunctions done:", lanes.nameof(GlobalFunc)) end local lanes = require "lanes".configure{ with_timers = false, on_state_create = RequireAModuleThatExportsGlobalFunctions} -- load some module that adds C functions to the global space -RequireAModuleThatExportsGlobalFunctions() +RequireAModuleThatExportsGlobalFunctions("main") local GlobalFuncUpval = GlobalFunc diff --git a/tests/package.lua b/tests/package.lua index de11c9e..4e8b59f 100644 --- a/tests/package.lua +++ b/tests/package.lua @@ -2,21 +2,21 @@ local loaders = package.loaders or package.searchers assert(nil == loaders[5]) -local configure_loaders = function() +local configure_loaders = function(type_) table.insert(loaders, 4, function() end) assert(loaders[1]) assert(loaders[2]) assert(loaders[3]) assert(loaders[4]) assert(loaders[5]) - print "loaders configured!" + print(type_, "loaders configured!") end -configure_loaders() +configure_loaders("main") for k,v in pairs(loaders) do print( k, type(v)) end lanes = require "lanes" -lanes.configure{with_timers=false, on_state_create = configure_loaders} \ No newline at end of file +lanes.configure{on_state_create = configure_loaders} \ No newline at end of file -- cgit v1.2.3-55-g6feb