lua里format打印boolean类型,如果使用了%s或%d会报如下错误:bad argument #2 to ‘format’ (string expected, got boolean)
解决方法:查了如下,把boolean转换成string再打印。
https://stackoverflow.com/questions/46056455/bad-argument-3-to-format-string-expected-got-boolean
You need to manually evaluate boolean type to string.
Try this,
string.format(“You%s need a %s”, negation, tostring(clothwear or summerwear or innerwear or southerwear or outerwear))
本文介绍了解决Lua中format函数在打印布尔值时遇到的'bad argument'错误,通过手动将布尔值转换为字符串解决,并提供了一个实例。
8398

被折叠的 条评论
为什么被折叠?



