Hiding Posted October 24, 2022 Share Posted October 24, 2022 (edited) Hello, I'm wondering why throw this error message? <name> expected near '" Some message"' local messages = { message1: " Some message", message2: " Some message2", } outputChatBox(messages.message1, source, 255, 255, 255, true) Edited October 24, 2022 by Hiding Link to comment
Addlibs Posted October 24, 2022 Share Posted October 24, 2022 (edited) It's a syntax issue -- you're not supposed to use a colon to separate the key from the value in a table. The correct character is an equals sign: local messages = { message1 = " Some message", message2 = " Some message2", } I believe "<name> expected" is referencing OOP style calls like SomeObject:someMethod(), (the only use of the colon in Lua that I can recall of the top of my head), as if you wrote :someMethod() without any object name in front, but Lua expects a object name there. Edited October 24, 2022 by Addlibs 1 Link to comment
Hiding Posted October 25, 2022 Author Share Posted October 25, 2022 (edited) Thank you so much Edited October 25, 2022 by Hiding Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now