Author Topic: CLScript  (Read 2456 times)

Tomaaz

  • Guest
CLScript
« on: April 22, 2013, 02:52:13 PM »
I know this project is not in development any more, but is it possible to compile a version that doesn't replace Lua print() function and works properly with Lua functions like io.write(), io.read() etc.?

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: CLScript
« Reply #1 on: April 22, 2013, 07:13:07 PM »
Just download the source code and delete thw print function and bindings. As for io.write() etc. I can't say why it doesn't work ...
Using the Lua print() gives some funny behaviur on Linux for example in a for loop:
Code: [Select]
for i =1,10 do
print (i)
end
This results in something like:
Quote
1
  2
    3
      4
        5
etc. although all numbers should be written in one line.

Tomaaz

  • Guest
Re: CLScript
« Reply #2 on: April 22, 2013, 07:32:57 PM »
Lua by default add a newline at the end when print() is used (however it writes in one line multiple arguments separated by comas eg. print(x, "is a number"). To write everything in one line you need to use io.write() that is much more flexible (adding newline etc. is of course possible).

Code: [Select]
for x = 1, 10 do
io.write(x)
end

The output is
Quote
12345678910

It works with pure Lua. It works with EGSL. Unfortunately, it doesn't work with CLScript (nothing is printed).

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: CLScript
« Reply #3 on: April 23, 2013, 07:51:50 AM »
Oh, I wasn't clear. I meant one line vertically, like this:
Quote
1
2
3
4
5
etc. but it's diagonally using the print() function.
Oh, maybe I know why it doesn't work: because of unit CRT. This overrides all console output, so only crt-functions work. I could change that but everything from color, locate, cls etc. will be lost, so it makes no sense to use CLScript anymore because one could use the lua interpreter...
« Last Edit: April 23, 2013, 07:54:49 AM by Cybermonkey »

Tomaaz

  • Guest
Re: CLScript
« Reply #4 on: April 23, 2013, 11:33:50 AM »
... but it's diagonally using the print() function.

That's really strange. It has never happened to me .

Oh, maybe I know why it doesn't work: because of unit CRT. This overrides all console output, so only crt-functions work. I could change that but everything from color, locate, cls etc. will be lost, so it makes no sense to use CLScript anymore because one could use the lua interpreter...

So, it doesn't work like "everything Lua can do + something extra"... OK, forget it then. Thanx anyway! :)