梅西大学商学院研究生:【转】lua table操作实例详解
来源:百度文库 编辑:偶看新闻 时间:2024/05/13 14:01:09
lua_gettable
lua_getglobal(L, "mytable") <== push mytable
lua_pushnumber(L, 1) <== push key 1
lua_gettable(L, -2) <== pop key 1, push mytable[1]
lua_settable
lua_getglobal(L, "mytable") <== push mytable
lua_pushnumber(L, 1) <== push key 1
lua_pushstring(L, "abc") <== push value "abc"
lua_settable(L, -3) <== mytable[1] = "abc", pop key & value
lua_rawget:
用法同lua_gettable,但更快(因为当key不存在时不用访问元方法__index)
lua_rawset:
用法同lua_settable,但更快(因为当key不存在时不用访问元方法__newindex)
lua_rawgeti必须为数值键
lua_getglobal(L, "mytable") <== push mytable
lua_rawgeti(L, -1, 1) <== push mytable[1],作用同下面两行调用
--lua_pushnumber(L, 1) <== push key 1
--lua_rawget(L,-2) <== pop key 1, push mytable[1]
lua_rawseti必须为数值键
lua_getglobal(L, "mytable") <== push mytable
lua_pushstring(L, "abc") <== push value "abc"
lua_rawseti(L, -2, 1) <== mytable[1] = "abc", pop value "abc"
lua_getfield必须为字符串键
lua_getglobal(L, "mytable") <== push mytable
lua_getfield(L, -1, "x") <== push mytable["x"],作用同下面两行调用
--lua_pushstring(L, "x") <== push key "x"
--lua_gettable(L,-2) <== pop key "x", push mytable["x"]
lua_setfield必须为字符串键
lua_getglobal(L, "mytable") <== push mytable
lua_pushstring(L, "abc") <== push value "abc"
lua_setfield(L, -2, "x") <== mytable["x"] = "abc", pop value "abc"
lua_getglobal(L, "mytable") <== push mytable
lua_pushnumber(L, 1) <== push key 1
lua_gettable(L, -2) <== pop key 1, push mytable[1]
lua_settable
lua_getglobal(L, "mytable") <== push mytable
lua_pushnumber(L, 1) <== push key 1
lua_pushstring(L, "abc") <== push value "abc"
lua_settable(L, -3) <== mytable[1] = "abc", pop key & value
lua_rawget:
用法同lua_gettable,但更快(因为当key不存在时不用访问元方法__index)
lua_rawset:
用法同lua_settable,但更快(因为当key不存在时不用访问元方法__newindex)
lua_rawgeti必须为数值键
lua_getglobal(L, "mytable") <== push mytable
lua_rawgeti(L, -1, 1) <== push mytable[1],作用同下面两行调用
--lua_pushnumber(L, 1) <== push key 1
--lua_rawget(L,-2) <== pop key 1, push mytable[1]
lua_rawseti必须为数值键
lua_getglobal(L, "mytable") <== push mytable
lua_pushstring(L, "abc") <== push value "abc"
lua_rawseti(L, -2, 1) <== mytable[1] = "abc", pop value "abc"
lua_getfield必须为字符串键
lua_getglobal(L, "mytable") <== push mytable
lua_getfield(L, -1, "x") <== push mytable["x"],作用同下面两行调用
--lua_pushstring(L, "x") <== push key "x"
--lua_gettable(L,-2) <== pop key "x", push mytable["x"]
lua_setfield必须为字符串键
lua_getglobal(L, "mytable") <== push mytable
lua_pushstring(L, "abc") <== push value "abc"
lua_setfield(L, -2, "x") <== mytable["x"] = "abc", pop value "abc"
mssql对table操作
C#.NET实例详解软件
混沌军团操作详解
寻VFP6.0操作实例
Lua 教程下载地址
为什么在VS2005中不能用dataset.table[tablename]提示未将对象实例化
为什么在VS2005中不能用dataset.table[tablename]提示为将对象实例化
黑帮生涯:帮派战争 操作详解
电动操作器冶金工业应用实例
问一个lua的问题
谁有AMD Sempron 2600+ (64bit)超频实例及详解?
求VB的全部函数及详解(有实例)如果是可以在线查询的更好.
侠盗车手5城市风云的键盘操作详解
那位可以向我推荐计算机系统操作详解
暗夜的熊加血的微操作?请详解
谁知道有auto cad2004在线实例操作讲解的网页
请问谁能提供“人民币利率互换”业务操作实例?
请各位高手推荐一本有关SolidWorks2005方面有关实例详解(例子多些的)方面的书籍
table tent
table show
table是什么意思
table是什么意思
谁有setup factory 中action(操作)的使用方法详解?
请问:有谁知道远程协议的用途是什么?具体该如何操作!(详解)