drk Posted March 24, 2012 Posted March 24, 2012 Hi. I need help with "find a string in the table". Here the code: -- Anims by Ezz Anim = { } Anim.__index = Anim local validTypes = { pulseOut = true, fadeIn = true, fadeOut = true, move = true, moveResize = true } function Anim:Create ( aElem, aType, aTable ) if ( validTypes [ aType ] ) then outputChatBox ( "Passed statement" ) end end If I use "if ( validTypes [ aType ] ) then" and I put "myAnim = Anim:Create ( myElem, pulseOut, { } )" or other thing in pulseOut it doesn't output nothing. If I put "if ( not validTypes [ aType ] ) then" when I put something who isn't in the table it output anyway. Any help? EPT Team Server Development: 0% Learning C++ | C++ is amazing
Aibo Posted March 24, 2012 Posted March 24, 2012 Anim:Create ( myElem, pulseOut, { } ) — pulseOut here is not a string, it's a variable, probably nil. if you're still making this kind of errors, perhaps it's not the time to dive into OOP and classes. ?
Kenix Posted March 24, 2012 Posted March 24, 2012 You need use metatables for create something like oop. http://lua-users.org/wiki/ObjectOrientationTutorial http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
drk Posted March 24, 2012 Author Posted March 24, 2012 Oh thanks! I read about setmetatable and I put it to work Tnx Kenix EPT Team Server Development: 0% Learning C++ | C++ is amazing
Kenix Posted March 24, 2012 Posted March 24, 2012 No problem http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
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