From 42838a87b8f49db2ae5781498edf4192c61a21a6 Mon Sep 17 00:00:00 2001 From: ame Date: Thu, 11 Jul 2024 12:49:35 -0500 Subject: make reg return table --- docs/readme.md | 11 ++--------- src/reg.c | 4 +--- tests/h.lua | 2 +- tests/hash.lua | 2 +- tests/net.lua | 2 +- tests/s.lua | 2 +- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/docs/readme.md b/docs/readme.md index 9427403..9fbb022 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -4,17 +4,10 @@ with the library in the same directory [(or one of the other valid search locations)](https://www.lua.org/pil/8.1.html) ```lua -require "llib" +llib = require "llib" ``` -which makes a global llib table - -> ### future require versions will eventually return the table -> ```lua -> llib = require "llib" -> ``` - -the table has many subtables and functions, with related function in them, you can view them like so +returns a table has many subtables and functions, with related function in them, you can view them like so ```lua llib.io.pprint(llib) --pprint is a part of the io module, pprint meaning pretty print diff --git a/src/reg.c b/src/reg.c index 13d5866..8c395d8 100644 --- a/src/reg.c +++ b/src/reg.c @@ -44,8 +44,6 @@ int luaopen_llib(lua_State* L) { lreg("config", config_function_list); lreg("net", net_function_list); lreg("thread", thread_function_list); - - //make llib global - lua_setglobal(L, "llib"); + return 1; } diff --git a/tests/h.lua b/tests/h.lua index 0913892..310d6a8 100644 --- a/tests/h.lua +++ b/tests/h.lua @@ -1,4 +1,4 @@ -require "llib" +llib = require "llib" llib.config.set({print_meta=1,max_depth=22}) --llib.thread.lock(1) diff --git a/tests/hash.lua b/tests/hash.lua index dce011f..b35515a 100644 --- a/tests/hash.lua +++ b/tests/hash.lua @@ -1,4 +1,4 @@ -require "llib" +llib = require "llib" local hashes_working = 0 local hashes_failed = 0 diff --git a/tests/net.lua b/tests/net.lua index 617d299..1afd02f 100644 --- a/tests/net.lua +++ b/tests/net.lua @@ -1,4 +1,4 @@ -require "llib" +llib = require "llib" llib.config.set({max_depth=5}) --local print = llib.io.pprint sleep = function(a) diff --git a/tests/s.lua b/tests/s.lua index 065408a..ae84e25 100644 --- a/tests/s.lua +++ b/tests/s.lua @@ -1,6 +1,6 @@ local t = function (a) end -require "llib" +llib = require "llib" local a = llib.crypto.md5() --llib.io.pprint(_ENV.a) -- cgit v1.2.3