static const struct luaL_reg iolib[] = { {LUA_ERRORMESSAGE, errorfb}, {"clock", io_clock}, {"date", io_date}, {"debug", io_debug}, {"execute", io_execute}, {"exit", io_exit}, {"getenv", io_getenv}, {"remove", io_remove}, {"rename", io_rename}, {"setlocale", setloc}, {"tmpname", io_tmpname}};
上面是Lua内置的函数.我不想通过函数名来调用函数.有办法在脚本里通过序号调用函数吗?
lua 中没有函数名这个概念,函数也是一种值。你以字符串为名仅仅只是把函数这个东西赋予某张表上的一个 key 而已。 - 回复 | (1331) | 云风 | 2006-11-30 11:06:00