I save the instructions to a file as code
An example file:
rs.setOutput("right",true)
sleep(1)
rs.setOutput("right",false)
Creating and saving is working great. My problem is reading the code again to be able to edit it.
I'd like to use string patterns to extract the arguments from the functions
Like this:
local func = [[rs.setOutput("right",true)]]
args = { string.match( func , "pattern") } --# Is it gmatch? EDIT: No, its string.match
print( textutils.serialize( args ) )
Expected Output:{
"\"right\"",
"true",
}
All the functions:
See spoiler below for ones I've completed
(All arguments should be returned as strings, side needs its quotes still)
rs.setOutput("side",state) --#> "side",state
rs.setBundledOutput("side",number) --#> "side",number
rs.setBundledOutput("side",colors.combine(rs.getBundledOutput("side"),number)) --#> "side",number
rs.setBundledOutput("side",colors.subtract(rs.getBundledOutput("side"),number)) --#> "side",number
Spoiler
NOTE I'd like 4 separate patterns, not one for all 4
( Is one for all 4 even possible? )
Edited by HPWebcamAble, 13 July 2015 - 08:12 PM.












