Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设您有下表:
mytable = {"firstelement", "secondelement", "thirdelement" } print (mytable [1]) ==> firstelement
我如何让它只打印“firstelement”中的“f”?
这是一个简单的字符串操作:
print(mytable[1]:sub(1,1))
更多信息可以在Lua 用户字符串库教程或Lua 参考手册中的字符串操作中找到
print( mytable[1]:sub(1, 1) )