LUA source code analysis tutorial

Source: Internet
Author: User

AboutLUA source codeThe analysis learning tutorial is the content to be introduced in this article, mainly to learnLuaFor details about the source code, see this article.

The original text is in English and can be translated into Chinese at a time. Hope you can give me some advice on bina prawns.

 
 
  1. Ldebug. c-debugging interface: including the lua_sethook/lua_gethook/lua_gethookcount function that accesses the debugging hook.
  2. Lua_getstatck/lua_getlocal/lua_setlocal), check the bytecode function luaG_checkopenop/luaG_checkcode ),
  3. And the function luaG_typeerror/luaG_concaterror/luaG_aritherror/luaG_ordererror/luaG_errormsg/luaG_runerror) that throws errors)
  4. Lzio. c-a common input stream interface with a buffer
  5. Lmem. c-memory management interface. Two functions, luaM_realloc and luaM_growaux _, are implemented by encapsulating the memory allocation function.
  6. Lgc. c-memory management of the Garbage Collector)
  7. Lstate. c-global context. Including lua_newstate/lua_close and LUA thread functions (luaE_newthread/luaE_freethread)
  8. Lobject. c-some general functions for Lua objects. Including data type to String Conversion Function, pure data equality test function luaO_rawequalObj), and log base 2luaO_log2)
  9. Lstring. c-string table stores all string sets operated by Lua)
  10. Lfunc. c-auxiliary functions for packaging prototype and Closure
  11. Ltable. c-Lua table implements hash)
  12. Lcode. c-Lua code generator. Used by lparser. c
  13. Llex. c-This method analyzer. Used by lparser. c
  14. Lparser. c-Lua syntax checker
  15. Lundump. c-load the pre-compiled Lua code block. The luaU_undump function loads a pre-compiled code block. The luaU_header (internal function used by luaU_undump) is used to check the function header.
  16. Ldump. c-Save the pre-compiled Lua code block. The luaU_dump function displays a function using the pre-compiled code string;
  17. Lopcodes. c-Lua VM operator. Define the names and information of all operators (saved in two tables: luaP_opnames and luaP_opmodes)
  18. Lvm. c-Lua virtual machine. Execute the bytecode luaV_execute ). Some functions that may be used by lapi. c, such as luaV_concat, are also exposed)
  19. The stack and call structure of ldos. c-Lua. Control function call luaD_call/luaD_pcall), stack growth, collaborative Code Synchronization
  20. Ltm. c-Method for marking primitives. Implementation of Object Access primitive methods (javashods)
  21. Lbaselib. c-basic function library
  22. Lstrlib. c-string Library
  23. Ltable. c-table operation Library
  24. Lmathlib. c-Math Library
  25. Loslib. c-operating system related libraries
  26. Liolib. c-Input Database
  27. Loadlib. c-module library implements the require function and package function)
  28. Ldblib. c-debugging Library
  29. Lapi. c-Lua API. Implement the Lua c api (lua _ * function) Set
  30. Lauxlib. c-define all luaL _ * function sets
  31. Linit. c-implement the luaL_openlibs method to facilitate loading the above modules in c Language
  32. Lua. c-Lua independent interpreter
  33. Print. c-defines "PrintFunction? "Function, used to print the bytecode in the function to be used by the-l parameter in luac. c)
  34. The luac. c-Lua compiler saves bytecode to a file and can also list bytecode)

The prefix of a external symbol indicates the module it comes from:

The prefix of the external symbol indicates which file the external symbol comes from:

 
 
  1. luaA_ - lapi.c  
  2. luaB_ - lbaselib.c  
  3. luaC_ - lgc.c  
  4. luaD_ - ldo.c  
  5. luaE_ - lstate.c  
  6. luaF_ - lfunc.c  
  7. luaG_ - ldebug.c  
  8. luaH_ - ltable.c  
  9. luaI_ - lauxlib.c  
  10. luaK_ - lcode.c  
  11. luaL_ - lauxlib.c/h, linit.c (public functions)  
  12. luaM_ - lmem.c  
  13. luaO_ - lobject.c  
  14. luaP_ - lopcodes.c  
  15. luaS_ - lstring.c  
  16. luaT_ - ltm.c  
  17. luaU_ - lundump.c  
  18. luaV_ - lvm.c  
  19. luaX_ - llex.c  
  20. luaY_ - lparser.c  
  21. luaZ_ - lzio.c  
  22. lua_? - lapi.c/h + luaconf.h, debug.c  
  23. luai_ - luaconf.h  
  24. luaopen_ - luaconf.h + libraries (lbaselib.c, ldblib.c, liolib.c, lmathlib.c, loadlib.c, loslib.c, lstrlib.c, ltablib.c) 

Summary: AboutLUA source codeThe content of the analysis and learning course has been introduced. I hope this article will help you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.