You call lua_pcall with the number of arguments you are passing and the number of results you want. The fourth argument indicates an error-handling function; we will discuss it in a moment. As in a Lua assignment, lua_pcall adjusts the actual number of results to what you have asked for, pushing nils or discarding extra values as needed. Before pushing the results, lua_pcallremoves from the stack the function and its arguments. If a function returns multiple results, the first result is pushed first; so, if there are n results, the first one will be at index -n and the last at index -1.

 


意思就是:当一个函数有多个返回值,第一个返回值首先push,第二个返回值再push,以此类推。

所以要想得到第一个返回值就:lua_toxxxx(L,1),第二个返回值就是lua_toxxxxx(L,2)

相关文章:

  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
猜你喜欢
  • 2021-11-06
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案