[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: stdlua.lua
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 27 Sep 2001 09:33:04 -0300
>I would like to propose a standard lua library. Written in Lua.
This is a good idea, because as has been mentioned in previous posts, Lua does
lack wider library support for scripting.
Nevertheless, I suggest some other name be chosen to avoid confusion with the
"standard libraries" that come with Lua, that is liblualib.a in Unix-speak.
>How to include:
>dofile("stdlua.lua")
>
>stdlua.lua should only expose a single global variable "stdlua" and all
>functions should be members in stdlua.
I suggest a more flexible scheme: in stdlua.lua (or whatever the name is),
test whether a table called "stdlua" exists. If it does, then stdlua.lua should
define only those functions whose name appear in the table. In this way, users
can choose the functions they need.
Example:
stdlua={clone=1, strtrim=1}
dofile"stdlua.lua"
In "stdlua.lua":
local select=stdlua
local L=settag({},newtag())
settagmethod(tag(L),"settable", function (i,v)
if not select or stdlua[i] then rawset(L,i,v) end
end)
function L.clone() ... end
function L.strtrim() ... end
function L.abort() ... end
...
stdlua=L
return L
--lhf