kuwalda Posted June 6, 2014 Share Posted June 6, 2014 I have simple question - if I have string value, can I use it as variable? example = { } example[settings][1] = "thePlayer" example[settings][2] = "root" example[settings][3] = "functionX" if isElementVisibleTo ( marker, example[settings][1] ) then Link to comment
xXMADEXx Posted June 6, 2014 Share Posted June 6, 2014 No, not like that. Maybe you can try it with the loadstring function. Link to comment
kuwalda Posted June 6, 2014 Author Share Posted June 6, 2014 any alternitives to this? Link to comment
xXMADEXx Posted June 6, 2014 Share Posted June 6, 2014 http://www.gammon.com.au/scripts/doc.php?lua=loadstring Link to comment
kuwalda Posted June 6, 2014 Author Share Posted June 6, 2014 Huge thanks to you, it was that I was searching for! Link to comment
Cadu12 Posted June 6, 2014 Share Posted June 6, 2014 _G do. _G["nameVar"] = 10 outputChatBox(nameVar) -- outputs 10 Link to comment
arezu Posted June 6, 2014 Share Posted June 6, 2014 any alternitives to this? If you can give an example of what exactly you are trying to do, then we can possibly give a better solution. Link to comment
kuwalda Posted June 6, 2014 Author Share Posted June 6, 2014 loadstring(raceActive["participate"]) does not work with if ( #loadstring(raceActive["participate"]) - 1 == value ) then Anyone can think out some alternative for using it here? Link to comment
ixjf Posted June 7, 2014 Share Posted June 7, 2014 It does not because that's not how it works. loadstring takes a string with Lua code, and all it returns is a function whose body is the code you passed. As for your issue, I'd rather do it manually than fill your code with ugly hacks. 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