463 posts
Location
Star Wars
Posted 07 April 2016 - 08:20 PM
I programmed a new edit and set the alias.
I tried to set the completion function:
shell.setCompletionFunction(customEditPath, shell.getCompletionInfo()['rom/programs/edit'])
What did I wrong?
And by the way, how works the set completion function?
749 posts
Location
BOO!!
Posted 07 April 2016 - 08:33 PM
function shell.setCompletionFunction( sProgram, fnComplete )
tCompletionInfo[ sProgram ] = {
fnComplete = fnComplete
}
end
Edited on 07 April 2016 - 08:44 PM
463 posts
Location
Star Wars
Posted 07 April 2016 - 11:44 PM
function shell.setCompletionFunction( sProgram, fnComplete )
tCompletionInfo[ sProgram ] = {
fnComplete = fnComplete
}
end
Why my completion doesn't work?
shell.setCompletionFunction(customEditPath, shell.getCompletionInfo()['rom/programs/edit'])
Edited on 07 April 2016 - 09:45 PM
749 posts
Location
BOO!!
Posted 08 April 2016 - 12:33 AM
and how works the set completion function?
3057 posts
Location
United States of America
Posted 08 April 2016 - 02:28 AM
When a variable is prefixed by fn, that means it's supposed to be a function. Furthermore, if a function name includes function in it, there's a pretty good chance that it wants a function.
TL;DR: Give it a function, not the completion info for 'rom/programs/edit'
7083 posts
Location
Tasmania (AU)
Posted 08 April 2016 - 03:53 AM
TL;DR: Give it a function, not the completion info for 'rom/programs/edit'
The completion info for 'rom/programs/edit' is, in fact, a function.
Relevant code:
shell.setCompletionFunction( sProgram, fnComplete )shell.getCompletionInfo()"rom/programs/edit" key in tCompletionInfo table gets setSo I guess the question is, "what's the value of customEditPath"? Is a
path set to it?
130 posts
Posted 08 April 2016 - 05:02 AM
The completion info for 'rom/programs/edit' is, in fact, a function.
No, the completion info is a table with an "fnComplete" key.
This should work (untested):
shell.setCompletionFunction(customEditPath, shell.getCompletionInfo()['rom/programs/edit'].fnComplete)
7083 posts
Location
Tasmania (AU)
Posted 08 April 2016 - 05:06 AM
*headdesk*
Yes, I'd say you've got it. :)/>
463 posts
Location
Star Wars
Posted 08 April 2016 - 09:26 PM
The completion info for 'rom/programs/edit' is, in fact, a function.
No, the completion info is a table with an "fnComplete" key.
This should work (untested):
shell.setCompletionFunction(customEditPath, shell.getCompletionInfo()['rom/programs/edit'].fnComplete)
Doesn't work: table expected got function
1080 posts
Location
In the Matrix
Posted 08 April 2016 - 09:55 PM
That code should work, can you show us what your code looks like?