Gravestone Posted September 5, 2016 Posted September 5, 2016 I am trying to check a global variable but everytime it is returning false. something1 = false something2 = false something3 = false something4 = false something5 = false function checksomething(_, _, ...) local d = table.concat({...}, " ") if tostring(d) == true then outputChatBox("true") return true else outputChatBox("false") return false end end addCommandHandler("checks", checksomething) But if I do it in this way: something1 = false something2 = false something3 = false something4 = false something5 = false function checksomething(_, _, ...) local d = table.concat({...}, " ") if something1 == true then outputChatBox("true") return true else outputChatBox("false") return false end end addCommandHandler("checks", checksomething) then it will return true. Any ideas how to fix this? Clan war system http://sh.st/7r4nI
MTA Team botder Posted September 5, 2016 MTA Team Posted September 5, 2016 if _G[tostring(d)] == true then _G is the global table. GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
Walid Posted September 5, 2016 Posted September 5, 2016 (edited) @Gravestone, _G predefined variable it returns a table of all global variables. Edited September 5, 2016 by Walid Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Gravestone Posted September 5, 2016 Author Posted September 5, 2016 Oh! Thanks for informing. Clan war system http://sh.st/7r4nI
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