ID:2191699
 
(See the best response by Nadrew.)
Is there a proc for text2literal to turn a string into a literal expression, such as

var/mud = text2literal("foo")
And what exactly would that do?
mud would then equal foo as a variable.
You mean the value of the "foo" variable?

var/foo = "blah"
var/mud = foo // "mud" = "blah"
No, I want to be able to generate the variable retrieved at run time like so.

var/foo = 1
var/fuu = 2

var/mud = text2literal("f[1 ? "oo" : "uu"]")

var/number = mud
Best response
You can use the vars list for that (just not for global variables)

var/mud = src.vars["f[1?"oo":"uu"]"]