1. if you want to use Lua in Delphi, if you do not understand the installation, you can choose not to install it. put the PAS file and two DLL files in the project directory, and add Lua to the uses part of the project.
2. If you want to run only one function in the file, it seems that you must first run the entire file, that is, you need to call the pcall function twice. This may be because a function list needs to be provided before running the function.
Lua_pcall (lua_script, 0, 0); <br/> lua_getglobal (lua_script, functionname); <br/> result: = lua_pcall (lua_script, 0, 1, 0 );
3. if a function parameter is in the form of table {1, 2, 3}, if you want to read the third value (3) In the table ), four functions must be used in the following order:
Lua_pushnumber (L, 3); // 3 indicates the 3rd-bit table <br/> lua_gettable (L,-2); //-2 indicates the position of the table in the stack. In this example, the table parameter is the last incoming stack, which is generally-1, but it is changed to-2 because it is pushed into another value, the table's position in the stack will be pushed out of the stack, and the value read from the table will go into the stack. <Br/> P: = lua_tostring (L,-1); // read the data at the top of the stack. <Br/> lua_pop (L, 1); // clear the stack.
4. There seem to be many Lua's Delphi translations. I useHttp://www.matrix44.de/lua/Download.