lua-users home
lua-l archive

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


Hey Geoff,
If I understand the question correctly, you want to see the keys/values
of all global variables in lua?

If so:
for key, val in pairs(_G) do
 print(key,val)
end

Obviously "val" will be rendered unsatisfyingly in cases of tables and
functions, but it'll give you an idea of what's there, at least. You
could do a check for tables and have a sub-loop to iterate through
those, if you liked..

On Tue, 26 Nov 2013 00:15:01 +0000
Geoff Smith <spammealot1@live.co.uk> wrote:

> Hi
>  
> Bit of a newbie type question I am afraid
>  
> For the purposes of a debugging aid, is it possible to iterate
> through and print out the contents of the Lua registry from a) pure
> Lua code, and b) from C using the C API ? I am guessing b) is
> possible but I cant find any example code or mention of this so I am
> wondering if that statement is actually true ? Thanks for any guidance
>  
> Regards  Geoff
>  		 	   		  

Attachment: signature.asc
Description: PGP signature