My first question is, does only string.find, string.sub and string.gmatch works for computercraft or does the other string functions from lua also work (like string.gsub)?
My second question is, how do I only use the first "result" of a function that gives more than one back, example:
I want a string.find() and instantly calculate with the first result of string.find() another value, but string.find("Apple","a")*100 doesn't work
And then I have a problem, I want to have a function that gets some arguments and then uses them to set a given value and also adds it to a some kind of inverted table:
function inputTabel(tableName, entry, addInverted)
entry = tableName
if addInverted then
--[[
-- Tablename format: table1["table2"]["table3"]
1. add [" and "] around the "table1"
2. add an "inverted" in front of the tableName --> inverted["table1"]["table2"]["table3"]
3. set the "table3" string as the value for inverted["table1"]["table2"]["entry"]
-- So basically I want to get also the key for a value in a table without knowing the key but knowing the value: ["Test"] = 5
-- I want then the key for the value 5
]]
end
end
Maybe there is also a easier way to get this: So basically I want to get also the key for a value in a table without knowing the key but knowing the value: ["Test"] = 5
I want then the key for the value 5
If so, I would really appreciate if you could tell me it
*Also by the way, there is a bug in this forum: When I activate for example "Italic", then write a line, deactivate it, press ENTER, write something else and then press backspace it acts like "Pos1", and this is only hapening here (Using a German Keyboard Layout)