RetroBASIC
Offtopic => Offtopic => Topic started by: Tomaaz 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.?
-
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:
for i =1,10 do
print (i)
end
This results in something like:
1
2
3
4
5
etc. although all numbers should be written in one line.
-
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).
for x = 1, 10 do
io.write(x)
end
The output is
12345678910
It works with pure Lua. It works with EGSL. Unfortunately, it doesn't work with CLScript (nothing is printed).
-
Oh, I wasn't clear. I meant one line vertically, like this:
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...
-
... 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! :)