| |||||||||||
| |||||||||||
List all tables and contents
Other Standard Library features. example from a Well House Consultants training course
More on Other Standard Library features. [link] Source code: basics Module: U112
--[[
This code lists all global variables (including standard functions) in your program, descening recursively into tables ]] function tellme(offset, story) local n,v for n,v in pairs(story) do if n ~= "loaded" and n ~= "_G" then io.write (offset .. n .. " " ) print (v) if type(v) == "table" then tellme(offset .. "--> ",v) end end end end tellme("",_G) --[[ Sample output [trainee@holt lm10]$ lua basics string table: 0x9bc25b8 --> sub function: 0x9bc4d00 --> upper function: 0x9bc4d30 --> len function: 0x9bc4bf8 --> gfind function: 0x9bc4b88 --> rep function: 0x9bc4c98 --> find function: 0x9bc4ae0 --> match function: 0x9bc4c60 --> char function: 0x9bc2618 --> dump function: 0x9bc2650 --> gmatch function: 0x9bc4b88 --> reverse function: 0x9bc4cc8 --> byte function: 0x9bc25e0 --> format function: 0x9bc4b18 --> gsub function: 0x9bc4bc0 --> lower function: 0x9bc4c28 xpcall function: 0x9bc1fb0 package table: 0x9bc2a50 --> preload table: 0x9bc2f38 --> loadlib function: 0x9bc2b30 --> loaders table: 0x9bc2ba0 --> --> 1 function: 0x9bc2c40 --> --> 2 function: 0x9bc2c58 --> --> 4 function: 0x9bc2c88 --> --> 3 function: 0x9bc2c70 --> cpath ./?.so;/usr/lib/lua/5.1/?.so;/usr/lib/lua/5.1/loadall.so --> config / ; ? ! - --> path ./?.lua;/usr/share/lua/5.1/?.lua; /usr/share/lua/5.1/?/init.lua;/usr/lib/lua/5.1/?.lua; /usr/lib/lua/5.1/?/init.lua --> seeall function: 0x9bc2b68 tostring function: 0x9bc1f08 print function: 0x9bc2020 os table: 0x9bc4208 --> exit function: 0x9bc44d8 --> setlocale function: 0x9bc24d8 --> date function: 0x9bc4430 --> getenv function: 0x9bc14e0 --> difftime function: 0x9bc4468 --> remove function: 0x9bc2488 --> time function: 0x9bc2510 --> clock function: 0x9bc43f8 --> tmpname function: 0x9bc2548 --> rename function: 0x9bc24a0 --> execute function: 0x9bc44a0 unpack function: 0x9bc1f78 require function: 0x9bc2fa0 getfenv function: 0x9bc1c48 setmetatable function: 0x9bc1e90 next function: 0x9bc1d68 assert function: 0x9bc1b98 tonumber function: 0x9bc1ed0 io table: 0x9bc3a00 --> lines function: 0x9bc3ef8 --> write function: 0x9bc4020 --> close function: 0x9bc2ab8 --> flush function: 0x9bc2ad0 --> open function: 0x9bc3f10 --> output function: 0x9bc3f48 --> type function: 0x9bc4008 --> read function: 0x9bc3fb8 --> stderr file (0xcff560) --> stdin file (0xcff420) --> input function: 0x9bc2ae8 --> stdout file (0xcff4c0) --> popen function: 0x9bc3f80 --> tmpfile function: 0x9bc3fd0 rawequal function: 0x9bc2058 collectgarbage function: 0x9bc1bd0 arg table: 0x9bc5d38 --> -1 lua --> 0 basics getmetatable function: 0x9bc1de0 module function: 0x9bc2d20 rawset function: 0x9bc20c8 ipairs function: 0x9bc19a0 math table: 0x9bc4de8 --> log function: 0x9bc54c0 --> max function: 0x9bc54f0 --> acos function: 0x9bc51c8 --> huge inf --> ldexp function: 0x9bc5450 --> pi 3.1415926535898 --> cos function: 0x9bc5318 --> tanh function: 0x9bc56f8 --> pow function: 0x9bc5588 --> deg function: 0x9bc5348 --> tan function: 0x9bc5730 --> cosh function: 0x9bc52e0 --> sinh function: 0x9bc5658 --> random function: 0x9bc55e8 --> randomseed function: 0x9bc5620 --> frexp function: 0x9bc5418 --> ceil function: 0x9bc52a8 --> floor function: 0x9bc53a8 --> rad function: 0x9bc55b8 --> abs function: 0x9bc5198 --> sqrt function: 0x9bc56c0 --> modf function: 0x9bc5550 --> asin function: 0x9bc5200 --> min function: 0x9bc5520 --> mod function: 0x9bc53e0 --> fmod function: 0x9bc53e0 --> log10 function: 0x9bc5488 --> atan2 function: 0x9bc5238 --> exp function: 0x9bc5378 --> sin function: 0x9bc5690 --> atan function: 0x9bc5270 debug table: 0x9bc57e8 --> getupvalue function: 0x9bc5bf0 --> debug function: 0x9bc3e10 --> sethook function: 0x9bc5c40 --> getmetatable function: 0x9bc5bd8 --> gethook function: 0x9bc3e40 --> setmetatable function: 0x9bc5cb0 --> setlocal function: 0x9bc5c78 --> traceback function: 0x9bc5d00 --> setfenv function: 0x9bc5c28 --> getinfo function: 0x9bc3e78 --> setupvalue function: 0x9bc5cc8 --> getlocal function: 0x9bc3eb0 --> getregistry function: 0x9bc5ba0 --> getfenv function: 0x9bc3e28 pcall function: 0x9bc1da0 table table: 0x9bc2828 --> setn function: 0x9bc2438 --> insert function: 0x9bc23c8 --> getn function: 0x9bc2358 --> foreachi function: 0x9bc2320 --> maxn function: 0x9bc2390 --> foreach function: 0x9bc22e8 --> concat function: 0x9bc2850 --> sort function: 0x9bc2470 --> remove function: 0x9bc2400 newproxy function: 0x9bc26b0 type function: 0x9bc1f40 coroutine table: 0x9bc2718 --> resume function: 0x9bc2880 --> yield function: 0x9bc2960 --> status function: 0x9bc28f0 --> wrap function: 0x9bc2928 --> create function: 0x9bc2868 --> running function: 0x9bc28b8 select function: 0x9bc1478 gcinfo function: 0x9bc1c10 pairs function: 0x9bc1a00 rawget function: 0x9bc2090 loadstring function: 0x9bc1d30 tellme function: 0x9bc6480 _VERSION Lua 5.1 dofile function: 0x9bc1c88 setfenv function: 0x9bc1e58 load function: 0x9bc1cf8 error function: 0x9bc1cc0 loadfile function: 0x9bc1e20 [trainee@holt lm10]$ ]] Learn about this subject
This module and example are covered on the following public courses:
* Learning to program in Lua * Lua Programming * Lua Programming Also available on on site courses for larger groups Books covering this topic
Yes. We have over 700 books in our library. Books
covering Lua are listed here and when you've selected a
relevant book we'll link you on to Amazon to order.
Other Examples
This example comes from our "Other Standard Library features." training module. You'll find a description of the topic and some
other closely related examples on the "Other Standard Library features." module index page.
Full description of the source code
You can learn more about this example on the training courses listed on this page,
on which you'll be given a full set of training notes.
Many other training modules are available for download (for limited use) from our download centre under an Open Training Notes License. Other resources
• Our Solutions centre provides a number of longer technical articles.
• Our Opentalk forum archive provides a question and answer centre. • The Horse's mouth provides a daily tip or thought. • Further resources are available via the resources centre. • All of these resources can be searched through through our search engine • And there's a global index here. Purpose of this website
This is a sample program, class demonstration or answer from a
training course. It's main purpose
is to provide an after-course service to customers who have attended our
public private or
on site courses, but the examples are made
generally available under conditions described below.
Web site author
Conditions of use
Past attendees on our training courses are welcome to use individual
examples in the course of their programming, but must check
the examples they use to ensure that they are suitable for their
job. Remember that some of our examples show you how not to do
things - check in your notes. Well House Consultants take no responsibility
for the suitability of these example programs to customer's needs.
This program is copyright Well House Consultants Ltd. You are forbidden from using it for running your own training courses without our prior written permission. See our page on courseware provision for more details. Any of our images within this code may NOT be reused on a public URL without our prior permission. For Bona Fide personal use, we will often grant you permission provided that you provide a link back. Commercial use on a website will incur a license fee for each image used - details on request. |
| ||||||||||
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho PAGE: http://www.wellho.net/resources/ex.php • PAGE BUILT: Sun Oct 11 14:50:09 2020 • BUILD SYSTEM: JelliaJamb |