Re: Can goto target a variable string label? If so, syntax?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Can goto target a variable string label? If so, syntax?
- From: Craig Barnes <craigbarnes85@...>
- Date: 2013年11月24日 02:00:25 +0000
P.S. Why not use a table of functions?
local action = {
Linux = function() print "Using Linux" end,
Darwin = function() print "Using Darwin" end,
-- ...
}
local fd = assert(io.popen("uname"))
local os = assert(fd:read())
fd:close()
action[os]()