bad argument #2 to 'table' (number expected, got string) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 原因在于,lua的table.insert 本来接收3个参数, table,pos,content 其中,pos可以省略,默认追加到table结尾 而我们gsub时候,实际上是返回了2个参数,所以insert时候被当作传入了3个参数,因此报错 因此...
"x")) --> 5 print(rawget(t, 2)) --> nil print(rawget("value",1))--> bad argument #1 to 'rawget' (table expected, got string) rawset (table, index, value) 将 table[index] 的值设置为 value 。table
1lua:function_demo.lua:144:bad argument #2 to 'find' (string expected,got nil源代码是这样的:local _,x=string.find(s,p)这是第144行,亲们,是什么原因啊 2lua: function_demo.lua:144: badargument #2 to'find' (stringexpected, gotnil源代码是这样的:local _,x=string.find(s,p)这是第144...
【题目】lua编程问题!本人是个小菜鸟,这个错误不知道怎么回事!ss = io.read()function GetWeekDay(ss)tu={"刺刀","石头”,“火枪”,“大炮”,“导弹”,"尼泊尔”,“潘多拉”}return tw[ss]end io.write(GetWeekDay(ss))错误ua: 测试1.lua:32: bad argument #1 to 'write'(string expected, got nil...
--Error提示:function_demo.lua:144: bad argument #2 to 'find' (string expected, got nil)--Error部分代码:local _,x=string.find(s,p)--Error的提示翻译过来就是:在function_demo.lua中的第144行,在"find"函数中第二个参数类型错误(应为字符串型,但为nil)--所以,错误的原因是p...
verbs = table: 0000000017FE3E40 bottom_root = root can_ [00:00:46]: [string "scripts/json.lua"]:475: bad argument #1 to 'gsub' (string expected, got boolean) LUA ERROR stack traceback: =[C]:-1 in (field) gsub (C) <-1--1> ...
)--> table: 0x7fd0b14074b0print(getmetatable("hello"))--> table: 0x7fd0b14074b0print(getmetatable(10))--> nilprint(getmetatable(false))--> nilprint(getmetatable(function()end))--> nilsetmetatable("hi",{})--> error:bad argument #1 to 'setmetatable' (table expected, got string...
lua:function_demo.lua:144:bad argument #2 to 'find' (string expected,got nil源代码是这样的:local _,x=string.find(s,p)这是第144行,亲们,是什么原因啊 扫码下载作业帮搜索答疑一搜即得 答案解析 查看更多优质解析 解答一 举报 你的提示已经很清楚了,传入的第2个参数 也就是p 是空 但实际需要的是...
io.read()用户输入任何东西都会为string类型 除非指定输入io.read("*number")这样就指定用户输入为number类型了 与无状态迭代器的对比 无状态迭代器将所有状态保存在for变量中 无需再开始一个循环时创建任何对象 基于closure实现的table比一个使用table的迭代器高效 ...
io.read()用户输入任何东西都会为string类型 除非指定输入io.read("*number")这样就指定用户输入为number类型了 与无状态迭代器的对比 无状态迭代器将所有状态保存在for变量中 无需再开始一个循环时创建任何对象 基于closure实现的table比一个使用table的迭代器高效 ...