local herbtable = {
w = "wormwood",
ma = "mandrake",
k = "kelp",
o = "orphine",
n = "nightshade",
g = "galingale",
mi = "maidenhair"
}
local herbvar = herbtable[matches[2]]
sendall("outr " ..herbvar.."","eat " ..herbvar.."",false)
Basically...I haven't looked for a mother Lua thread and really want help. I'm also buying @(anybody with a system)'s system for ~100 credits.............
Comments
function sendall(...)
local pass = arg[#arg] -- #arg gives us the last element of the table arg, and we store this to (1) check if it is a boolean, (2) manipulate further actions based on (1)
local show = true -- default state
if type(pass) == "boolean" and not pass then show = false end
-- here type(pass) is checked to see if it is a true/false variable (boolean), if it is not, we do nothing, and show defaults to the default value of true.
-- however, if type(pass) is a boolean, we next check if it is false because this is the only time it matters to us, therefore:
-- not pass is evaluated to true only if pass is false
-- therefore, in this case, if the last argument is a boolean and only if it is false, do we change our default value show
for i=1,#arg do
send(arg[i],show) -- send the code
end
end
Final function:
function sendall(...)
local pass = arg[#arg]
local show = true
if type(pass) == "boolean" and not pass then show = false end
for i=1,#arg do
send(arg[i],show)
end
end
One could argue with server side separators, this could be more elegant;
sp = "|" -- naming my global separator
function send_all(...)
local str = ""
for i=1,#arg do
if type(arg[i]) == "string" then
str = str..arg[i]..sp
end
end
if type(arg[#arg]) == "boolean" then
send(str,arg[#arg])
else
send(str)
end
end
(read: I'll decipher when I'm sober :P)
Secondly, you have an extra " in it. Should be sendAll("outr "..herbvar, "eat "..herbvar, false)
Alternatively, send("outr "..herbvar..";eat "..herbvar, false) [change ; to whatever your command separator is]
(If that doesn't work, alter your table as done in the quote)
In non-coding based technicalities, you don't need to outr plants anymore, here. You can just straight up "eat kelp".
"On the battlefield I am a god. I love war. The steel, the smell, the corpses. I wish there were more. On the first day I drove the Northmen back alone at the ford. Alone! On the second I carried the bridge! Me! Yesterday I climbed the Heroes! I love war! I… I wish it wasn’t over."