Mark
> On 25 Apr 2015, at 12:53, Mark Wieder <[email protected]> wrote:
>
> On 04/23/2015 11:09 PM, Peter W A Wood wrote:
>
>> I’m trying to find a better way than:
>>
>> if the environment is “server” then
>> put tResult
>> else
>> put tResult after Field tReport
>> end
>
> That's exactly how I deal with it, with the exception that I wrap it in a log
> function. That way there's only one place in the stack that needs to check
> the environment, and I can also put other conditions in the log file as needed
>
> command log pMessage
> if there_are_things_to_add_to_the_message ...
> end if
> if verboseMode ...
> if the environment is ...
> put ...
> else
> put ...
> end if
> end if
> end log
>
> log "I made it to function" && param(0)
> log "at this point the value of foo is" && foo
>
> --
> Mark Wieder
> [email protected] <mailto:[email protected]>
Thanks for that suggestion, I’ve does something like that.
I’ve now worked out a way of doing it without having to test the environment
each time that I want to call put by using dispatch. There is an additional
function call in place of checking the environment though.
local tReporter
command stackReporter pResult
put pResult & return after Field tReport
end stackReporter
command scriptReporter pResult
put pResult & return
end scriptReporter
command reportResult pResult
dispatch tReporter with pResult
end reportResult
if the environment is "server" then
put "scriptReporter" into tReporter
else
put "stackReporter" into tReporter
### code to set tReport # # #
end if
reportResult "My Result”
Regards
Peter
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode