Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DWScript: how do I get Result after Call

Alright, I am totally new to DWScript. For now I am fascinated by its abilities, but although I read all the pages in the accompanying wiki and questions/answers here I still cannot find a way to extract the result after a function is called from Delphi like this:

  func := m_dwsExec.info.Func[funcname];
  func.call(params);

and then I'm stuck: exec.result.toString gives me nothing. As long as I see I have no Result in the exec object and that's why when clearing the items from the script stack the result is being removed and lost. Please advice me on what is the proper way to do this simple task?

like image 229
Nedko Avatar asked Jan 09 '13 14:01

Nedko


1 Answers

Edit:

As Eric Grange stated in the comments below the best practice is like this:

  func := m_dwsExec.info.Func[funcname];
  info := func.call(params);
  funcresult := info.ValueAsString; //or Value, ValueAsInteger, etc.

Original answer:

Well I found the answer - the missing result is located in the data property of the returned IInfo object:

  func := m_dwsExec.info.Func[funcname];
  info := func.call(params);
  funcresult := info.data[0]
like image 190
Nedko Avatar answered Sep 28 '22 20:09

Nedko