Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何打印表格元素的第一个字符?_String_Lua_Lua Table - Fatal编程技术网

String 如何打印表格元素的第一个字符?

String 如何打印表格元素的第一个字符?,string,lua,lua-table,String,Lua,Lua Table,假设您有下表: mytable = {"firstelement", "secondelement", "thirdelement" } print (mytable [1]) ==> firstelement 如何使其仅打印“firstelement”中的“f”?这是一个简单的字符串操作: print(mytable[1]:sub(1,1)) 更多信息可在或中找到这是一个简单的字符串操作: print(mytable[1]:sub(1,1)) 更多信息可在或打印(mytable

假设您有下表:

mytable = {"firstelement", "secondelement", "thirdelement" }

print (mytable [1]) 
==> firstelement

如何使其仅打印“firstelement”中的“f”?

这是一个简单的字符串操作:

print(mytable[1]:sub(1,1))

更多信息可在或中找到这是一个简单的字符串操作:

print(mytable[1]:sub(1,1))
更多信息可在或

打印(mytable[1]:sub(1,1))
打印(mytable[1]:sub(1,1))