读书人

lua 返回表有关问题

发布时间: 2012-02-10 21:27:42 作者: rapoo

lua 返回表问题
一个lua 中的某函数.会返回两个参数:一个bool,一个表
如:lua中

C/C++ code
function MyFunc(szName)    local t = {}    t.Name = szName    t.Age = 10    return true, tend


在程序中调用 这个函数
Delphi(Pascal) code
  lua_getglobal(L,'MyFunc');  lua_pushstring(L, 'Name');  if (lua_pcall(L, 1, 2, 0) <> 0) then begin    lua_pop(L, 1);    exit;  end;  lua_toboolean(L,-1); //取第一个返回值  lua_pop(L, 1);  //然后这里的表该如何获得?


麻烦各位朋友贴下代码,c++或delphi都可

[解决办法]
纯jf

读书人网 >其他开发语言

热点推荐