lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 30/09/15 12:56 PM, Sean Conner wrote:
It was thus said that the Great Soni L. once stated:
In Lua you have 2 options:

1) Use function upvalues. (for local access)

2) Use the module table. (for shared access)

There's no such thing as a "registry" in Lua, it only exists in C (and
debug). I want to bring Lua on par with the C API and vice-versa.
   I think I may have mentioned this before, but wrap Lua in Lua.

	lua = require "lua"

	L = lua.Lnewstate()
	L:Lopenlibs()
	
	L:getglobal("print")
	L:push("this is a string")
	L:call(1,0)

   Short of that, what's in the C API that isn't available from Lua?

   -spc (debug.getregistry() called.  It's a bit miffed)

Well there are no functions to manipulate varargs as in

insert(pos, newarg, ...) -> return ...[1,pos], arg, ...[pos+1,-1]
remove(pos, ...) -> return ...[1,pos-1], ...[pos+1,-1]
replace(pos, arg, ...) -> return ...[1,pos-1], arg, ...[pos+1,-1]
sort([f ,]...) -> return sorted ...
reverse(...) -> return reversed ...
slice(i, j, ...) -> return ...[i, j]
etc

Either way, the original suggestion is/was to REMOVE the registry, not to make it available from Lua. If Lua doesn't need a registry then neither does C.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.