Jump to content



Photo

Project: Cplua


  • Please log in to reply
858 replies to this topic

#521 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 27 February 2006 - 10:15 PM

Okay, let's try again :D

CPLua 0.8 RC2 fixes all the bugs you reported, and some other ones (the interactive mode for example was completely unusable <_< )

Thanks again for your help :)

#522 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 28 February 2006 - 03:47 PM

Okay, let's try again :D

Seems to be ok now :).

Actually I used DLMFit as benchmark to check the gain in performances concerning the memory usage ;)
Note that the problem with those programs don't really come from the garbage collection; it's just that LuaNumAn is rather large, and each chunk loaded in Lua requires a lot of memory (3 to 5 times its size as source code! :blink: ).

DLMfit has two examples for curve fitting. It defines and uses rather large matrices, and it requires several library chunks, so it is currently a "memory devourer". Loading library chunks is unavoidable, if you want to write well-structured programs, so I'm afraid that DLMfit's memory demands cannot be reduced. Glad to know that it also helps as a check program.

Btw, I noticed that you allways load the libraries at the beginning of each chunk. That means that even if you use a function at the very end of the program (LuaPlot for example), you reserve a lot of memory for it at the beginning, hence the memory crashes. Maybe you should consider using doscript() instead of require() for functions like LuaPlot: you may also pass some arguments to the called script, and return some value, but the advantage is that you only load the chunk when you really need it ;) require() could also be used near the end of a program, not only at the beggining.

I have thought about this several times, but I think that loading all the chunks from the beginning helps the user to easily find the dependencies of the program. Loading each chunk just where it is needed is also a good programming habit; for example require("LuaPlot/PlotFunc") can be placed just before the first call of PlotFunc function. However, the user will need to search the whole program just to find the dependencies (and, currently, there is no a "Find" capability :(). Furthermore, I don't know what will happen if require("LuaPlot/PlotFunc") is whithin a loop...

It's just a file containing your preferences: the keyboard and the font you choosed (there will certainly be more options later). It is saved each time you close CPLua. I'm sorry about this, but I didn't have many choices ;)

As I suspected. No problem for me. Better than setting your preferences each time you open CPLua.

If you just want to exchange Lua programs with text files on the computer, you can copy/paste the code from the emulator... :huh: Note there will never be a "magic tool" to transform a MCS files with Lua programs (even saved as TEXT variables) into a simple txt file on the computer... :( You will allways have to deal through the emulator. I agree it could be convenient to be able to save the output of a program however.

Aaargh! Can you believe this? I didn't knew that you can mark, copy and paste text directly from the emulator :banghead:. To be honest, I don't use the emulator much (just to take screenshots).

#523 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 28 February 2006 - 03:59 PM

If I understand, you want to save the output of a program in a .TXT file. In that case, why don't you use Windows functions from fstream in the add-in (only for Windows, I am not stupid)? This doesn't work?

#524 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 28 February 2006 - 05:07 PM

Seems to be ok now :).

Kilburn noticed some other bugs in RC2, and I fixed it. There should be a new RC3 version soon, but I will wait a little to see if someone else encoutered problems with the RC2 ;)

Aaargh! Can you believe this? I didn't knew that you can mark, copy and paste text directly from the emulator :banghead:. To be honest, I don't use the emulator much (just to take screenshots).

Well, I was suspecting it :lol2:

If I understand, you want to save the output of a program in a .TXT file. In that case, why don't you use Windows functions from fstream in the add-in

I suppose the goal is to save the output of programs running on the classpad, more than on the emulator... :unsure:
However, if you really want it I could perhaps add an import/export facility in the editor (on the emulator only) to open or save an ordinar Lua program in a computer's txt file... I'll think about that :)
Note that you could simply use copy/paste between the emulator and the notepad though.

#525 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 01 March 2006 - 01:39 PM

What does "RC" mean?

#526 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 01 March 2006 - 02:44 PM

What does "RC" mean?

"Release Candidate". It's a very common abbreviation in version numbering schemes ;). Another option is "pre", which means "pre-release". Both are handy, although I personally don't like abbreviations.

#527 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 01 March 2006 - 08:02 PM

I hope it will be the last version until CPLua 0.8 final ;)

Download CPLua 0.8 RC3 :)

#528 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 07 March 2006 - 08:40 AM

Since there were no new bugs for several days, I think that CPLua 0.8 (final) will be released soon :)

There was a last bug in CPLua 0.8 RC3 though: if an error occurs in a chunk called with require or doscript, it doesn't stop the main program; it just continues after the call. This can lead to some strange situations, but it has already been fixed for the next version ;)

#529 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 07 March 2006 - 03:11 PM

Some suggestions (if you won't become unhappy):
1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.
2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.
3. Step-by-step debugging.
4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).
Thanks, bye. :)

#530 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 07 March 2006 - 03:47 PM

Some suggestions (if you won't become unhappy):

Although I'm not Orwell, I think I have something to say:

1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.

I'm afraid that I don't understand, or you are confused a little bit... You can "write your calcs" in the input window, which is enabled by the "input" function. Currently, the input window is restricted to one-line, at the bottom of the screen.

2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.

Sounds useful. Note, that this is for user's information only; CPLua has full access to user (or system) variables, via the "cas" function.

4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).

This subject has been discussed several months ago. Orwell said that he will not upload CPLua to classpad.org until it reaches version 1.

#531 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 07 March 2006 - 05:59 PM

Hi! My problem is concerning IO package... its cannot make a list of directories in Root Directory... what I need is fold:content() which lists folders. Is it possible to do it? (options are: list of folders or access to variables manager)

About MainWindow... PAP You are right... there is input line, but we can all agree that one line calculation is not enough. I know, You can say now that Lua should do the calculations, but in my case I often need to pre-calculate something before I can feed a program with data.

#532 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 07 March 2006 - 07:10 PM

1. Did you add a function for calling Main, orwell? (e.g ShowMainWindow). It is useful... We can create a math program that at the top section Lua's output says what to do, and we write our calcs in the bottom part that is the Main window.

I see what you want, but it is very difficult to do... :( When I started CPLua I decided to use my own system to manage the different windows (main menu, edition, console...) instead of the standard system used by the other applications. It is now quite easier to handle windows with this, and it allows some other interesting features (custom keypads, full screen, ...), so I think that it was a good choice; however I can't display a window that uses the standard system (like the Main Application) anymore :(
However, I don't think that it's completely impossible to do, but this would take time ;)

2. Please enable lua to access the Variable Manager... The open and save dialogs are good, but they don't show the file's size.

It's already done since CPLua 0.8 RC1 ... Look in the "Settings" menu, there is an option to open the Variable manager :)

3. Step-by-step debugging.

It is possible to create a debugger, and there 2 ways to do that.
1) convert the standard "debug" package to CPLua; it is currently disabled, but I hope that it won't be too hard due to CPlua's specifications (like chunk isolation etc)... I will take a look.
2) use some hacks to break the execution between each line, or between each instructions etc, and display information about the current existing variables, the environment... This would be a real debugger. I shouldn't be too hard (Lua allows that); however, the screen of the ClassPad isn't very large and I don't know how I should display all these informations :roflol:
I need your ideas and opinions about this :rolleyes:

4. (The most important one) Why don't you upload CPLua to classpad.org? It can be a good advertisement for Lua (and for the ClassPad forums).

Like PAP said, I would like to wait the first official version. I don't want too many people to start some big projects, and be forced to modify it between each major release because of some new incompatibilities.
But don't worry, CPlua 1.0 should come soon; I don't think that there will be many structural changes after CPLua 0.8 (but if you think about some large improvements or important modifications, say it NOW! ) ;)


Hi! My problem is concerning IO package... its cannot make a list of directories in Root Directory... what I need is fold:content() which lists folders. Is it possible to do it? (options are: list of folders or access to variables manager)

Whoops, it seems like there are still some functions in this package waiting to be implemented. :blush: I'll see what I can do ;)

About the Main Window again: remember that you can use the CAS package to create variables and save their values... You could for example write a Lua program that creates a list in the variable manager, and use this list for some later calculations in the Main Window :) I know that it's less handy, but it's better than nothing ;)

#533 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 07 March 2006 - 07:33 PM

Like PAP said, I would like to wait the first official version. I don't want too many people to start some big projects, and be forced to modify it between each major release because of some new incompatibilities.
But don't worry, CPlua 1.0 should come soon; I don't think that there will be many structural changes after CPLua 0.8 (but if you think about some large improvements or important modifications, say it NOW! ) ;)

I would like to insist on this a little bit more: If you think that something could be made in another, more comfortable way (for example, you have a better idea for the menu that appears when you open CPLua :lol: ), please say it, it's not too late ;)

#534 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 07 March 2006 - 09:06 PM

Using occasion: searching/replacing ability should be developed in editor.
Was You thinking about this My Lua Programs (for faster programs launching) ?

#535 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 07 March 2006 - 09:28 PM

Was You thinking about this My Lua Programs (for faster programs launching) ?


Were you thinking.... no? :roflol:
This has be already asked, I think this is not impossible to implement.

And there is a strange problem about the draw.line function that was here since CPLua 0.6. In the Scribble example program, il you set the drawing thickness to 3 or higher, the lines doesn't draw correctly.... :blink:

#536 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 07 March 2006 - 10:16 PM

Were you thinking.... no? :roflol:

Many people here (like the two of us too) have a native language which is different from English. We are all doing our best to be understood by the others, but some people may have more difficulties than the others. I think that such comments should be avoided, if possible. <_<
And Kilburn, I'm sorry to say that, but it seems like the mean age of people here is 19~20 year old (or maybe older). Why do you allways make us remember that you're only 14? Sometimes a more mature behavior would be welcome ;)

#537 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 08 March 2006 - 12:21 AM

It is possible to create a debugger, and there 2 ways to do that.
1) convert the standard "debug" package to CPLua; it is currently disabled, but I hope that it won't be too hard due to CPlua's specifications (like chunk isolation etc)... I will take a look.
2) use some hacks to break the execution between each line, or between each instructions etc, and display information about the current existing variables, the environment... This would be a real debugger. I shouldn't be too hard (Lua allows that); however, the screen of the ClassPad isn't very large and I don't know how I should display all these informations :roflol:
I need your ideas and opinions about this :rolleyes:

I think that a "pause" command will be sufficient. We can use it to temporarily suspend program execution, and enter the "interactive" mode. Note that this should be a "dedicated" interactive mode, able to access variables of the chunk being run. This way we will be able to inspect the values of variables, by using standard CPLua functions in the interactive mode (such as print or table.foreach), or to assign new values to the variables. Then a "resume" command will return CPLua to normal program execution, until another "pause" command is reached. This functionality is similar to the "breakpoints" used in all developement packages. It will not be a "real" debugger, but it will be very useful, and it seems easier to implement.

searching/replacing ability should be developed in editor.

IMHO, this should be considered as the first thing in the "to do" list. However, I'm afraid that it is not as easy as it looks. Orwell, what do you think?

And there is a strange problem about the draw.line function that was here since CPLua 0.6. In the Scribble example program, il you set the drawing thickness to 3 or higher, the lines doesn't draw correctly.... :blink:

I noticed this problem only recently, since I don't use thick lines often. When I implemented LuaPlot (4 months ago), it was possible to use line thicknesses of 3 or more pixels. Now, such thick lines are not drawn correctly. This is probably a bug in the "draw" package.
Btw, is it possible to add another optional argument in the "line" function, so that dashed lines will be available?

Many people here (like the two of us too) have a native language which is different from English. We are all doing our best to be understood by the others, but some people may have more difficulties than the others. I think that such comments should be avoided, if possible. <_<

I totally agree. English is not a very rich language, anyway.

#538 MicroPro

MicroPro

    Casio Overlord

  • Deputy
  • PipPipPipPipPipPipPip
  • 640 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    Casio ClassPad 300

Posted 08 March 2006 - 09:39 AM

Accessing Variable Manager is already done since CPLua 0.8 RC1

:blush: Yes, I saw it, thanks.

It is possible to create a debugger, and there 2 ways to do that:
...
However, the screen of the ClassPad isn't very large and I don't know how I should display all these informations.
I need your ideas and opinions about this

Maybe:
ShowMsg("Var1:"..FirstVar.."\nVar2:"..SecondVar)
It shows a message box. How do you think about it?

I will take a look.

Again thanks.

And a question:
Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?

#539 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 08 March 2006 - 09:12 PM

Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?


No... :(

And for the debugger, you could make a simple function debug() that displays a big dialog window with all the variables used and their values. Is that possible? And assign a "debug" key that will be never used in the program, so if you define EXE as the debug key, when you press EXE, the executions breaks and the dialog window appears.

#540 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 09 March 2006 - 10:28 AM

I think that a "pause" command will be sufficient. We can use it to temporarily suspend program execution, and enter the "interactive" mode. Note that this should be a "dedicated" interactive mode, able to access variables of the chunk being run. This way we will be able to inspect the values of variables, by using standard CPLua functions in the interactive mode (such as print or table.foreach), or to assign new values to the variables. Then a "resume" command will return CPLua to normal program execution, until another "pause" command is reached.

And for the debugger, you could make a simple function debug() that displays a big dialog window with all the variables used and their values. Is that possible? And assign a "debug" key that will be never used in the program, so if you define EXE as the debug key, when you press EXE, the executions breaks and the dialog window appears.

Okay I will first try to convert the standard "debug" package then :)
The idea concerning a "debug key" sounds interesting, but which key would you suggest? :unsure:

IMHO, this should be considered as the first thing in the "to do" list. However, I'm afraid that it is not as easy as it looks. Orwell, what do you think?

What do I think? I think that it's a real nightmare :cry: But if you really need it, I'll try... <_<

ShowMsg("Var1:"..FirstVar.."\nVar2:"..SecondVar)
It shows a message box. How do you think about it?

It is certainly useful, not only for debugging; but this should be a part of a future "UI" package ;)

Is there a Wait function in Lua? Or I still must use "for x=0,1000 do end" for wait?

I can't implement such a function with the SDK (at least for now)... :( Or maybe only for an entire number of seconds (e.g. wait(5) = wait 5 seconds). I don't have currently any way to measure time with a better precision. ;)

#541 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 09 March 2006 - 01:27 PM

The idea concerning a "debug key" sounds interesting, but which key would you suggest? :unsure:


A function like setdebugkey(key_code) :) Or a Debug button on the toolbar, near Break.

#542 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 09 March 2006 - 01:54 PM

I don't have currently any way to measure time with a better precision. ;)


SH3Timers could be used, but it's an unsupported featureand it doesn't work on PC. :( Maybe there is a Windows timer...

#543 narmo

narmo

    Newbie

  • Members
  • Pip
  • 7 posts
  • Location:Poland

  • Calculators:
    Classpad

    CFX-9850GB plus

Posted 19 March 2006 - 06:04 PM

I've found a bug:
for a = 0, 10, 0.1 do
 if a == 1 then 
  print("found")
 end
end
Never prints "found" although it should. I think it's a problem with float numbers.

#544 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 19 March 2006 - 06:09 PM

I've found a bug:

for a = 0, 10, 0.1 do
 if a == 1 then 
  print("found")
 end
end
Never prints "found" although it should. I think it's a problem with float numbers.

This is not a bug, actually. It's a common problem with computer arithmetics: 0.9+0.1 is not necessarily equal to 1. It may be 0.9999999999 or 1.000000000001, due to the way float numbers are stored in memory. You should never compare float numbers this way. Just replace a==1 with math.abs(a-1)<tiny, where tiny is a small number, e.g., 1e-7. Note that the same problem is present in every computer system.

#545 narmo

narmo

    Newbie

  • Members
  • Pip
  • 7 posts
  • Location:Poland

  • Calculators:
    Classpad

    CFX-9850GB plus

Posted 19 March 2006 - 06:32 PM

You're right, thanks.

#546 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 19 March 2006 - 07:16 PM

Indeed, I can't help it at all... :(
However, you don't have this problem with the other ClassPad applications, because it uses BCD numbers instead of float numbers. But this uses a lot more memory and is considerably slower.

Users who want to work with true precision should consider the CAS package, which uses BCD numbers... Btw I just saw that comparators ( <, >=, etc) between CAS objects would be useful too for that kind of problems, I will take a look on it.

#547 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 19 March 2006 - 09:43 PM

Why this works fine:

require "dane"

function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end

a=5.2
b=-3

wydruk(a-0.2,b+6)


And this not:

require "dane"

function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end

a=input()
b=-3

wydruk(a-0.2,b+6)



"tab1" is a large 2 dimensional table stored in "dane"

:blink:

#548 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 19 March 2006 - 09:58 PM

This should work. ;)

require "dane"

function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end

a=input()
b=-3

a=tonumber(a)

wydruk(a-0.2,b+6)


#549 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 19 March 2006 - 10:08 PM

input() allways returns a string, if you want to use it as a number you shoud use tonumber() like Kilburn suggested.

Be careful with CPLua 0.8C: there could be an error in your script "dane", and CPLua won't raise any error; it will just stop its execution and continues after the call to require. This is really annoying and has been corrected for the next version that I must release quickly :banghead:

#550 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 19 March 2006 - 10:22 PM

Ok, with tonumber() I just forgottent put it here in this example, but look at this:

require "dane"

function wydruk(wiersz,kol)
for i=wiersz,wiersz+8 do
print(tab1[i][kol])
end
end

a=input()
b=-3

a=tonumber(a)

wydruk((a-5)/0.2,b+6)


This rises error.

And I have still another question: what is biggest size of table Lua can handle?

#551 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 19 March 2006 - 11:08 PM

This rises error.

Try to run your library "dane", and be sure that the only error you have then is "Scripts are not authorized to export symbols" at the end. There may be a problem in this script, and your table "tab1" won't be exported correctly in that case...

And I have still another question: what is biggest size of table Lua can handle?

As much as the ClassPad's memory can handle ;) You could write a small script that fills a table until you get a message saying "not enough memory" :rolleyes:

#552 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 20 March 2006 - 12:31 AM

Try to run your library "dane", and be sure that the only error you have then is "Scripts are not authorized to export symbols" at the end. There may be a problem in this script, and your table "tab1" won't be exported correctly in that case...


Nope... it isnt it... runs correctly...

As much as the ClassPad's memory can handle ;) You could write a small script that fills a table until you get a message saying "not enough memory" :rolleyes:

I prepared a table in file and I wanted to use it as a library ( require "dane"). File size is 10KB and it seems to be too much... I think I will have to divide it in smaller parts, and call only this part which is currently needed

#553 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 21 March 2006 - 09:24 PM

Just a stupid idea :blush: Would you write My Lua Programs in C++ or Lua? It would be possible in Lua, as you will add "ui" package :) And functions like draw.cptext and draw.luatext might be useful (I know, I already asked it... :unsure: )

And another idea: It would be handy that we could "compile" all source codes and resources (packages, images, MEM files...) into one single project file. So, when you open the project, all the source files will be opened. I think about a "Project Manager" option, where you add or remove files and pictures from the project.

#554 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 21 March 2006 - 09:31 PM

This is old idea... I already tried to write it in Lua, but this function for directory listing is missing so at themoment its possible but only within one directory... But I think that writing My Lua Programs in C++ shouldnt be so hard.. some modifications in main code editor and thats all, but all depends on Orwell, he must say if its really possiible.

#555 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 25 March 2006 - 01:47 PM

Lately I often get error informing that I used all memory... how much memory Lua can accomodate for its variables? Is it possbile to build-in something like swap file? Currently memory allowed to use is not enough, and Im sure that many of us met with such error before...

#556 Kilburn

Kilburn

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 491 posts
  • Gender:Male
  • Location:France
  • Interests:Blah

  • Calculators:
    FX-7500 G
    ClassPad 300

Posted 25 March 2006 - 07:49 PM

Yes I also noticed this. When I try to write 40 5*5*4 matrices in a file, I have the error "Not enough memory", although I still have 400 KB free. (40 5*5*4 matrices should create a file of size 40000 bytes)

#557 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 25 March 2006 - 07:54 PM

From my experience: more than 10KB crashes execution... ok.. I can do it other way, this time.. but soon maybe not and then it will be problem... build in data swapping would be good way. There could be one file for this in this new Lua folder

#558 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 26 March 2006 - 09:22 AM

And functions like draw.cptext and draw.luatext might be useful

It shouldn't be too hard to implement... I'll think about it

And another idea: It would be handy that we could "compile" all source codes and resources (packages, images, MEM files...) into one single project file. So, when you open the project, all the source files will be opened. I think about a "Project Manager" option, where you add or remove files and pictures from the project.

The only files that CPLua's editor can edit are the files containing Lua programs... I don't exactly see what you would mean by "open images or MEM files" :unsure:

Lately I often get error informing that I used all memory... how much memory Lua can accomodate for its variables? Is it possbile to build-in something like swap file? Currently memory allowed to use is not enough, and Im sure that many of us met with such error before...

Yes I also noticed this. When I try to write 40 5*5*4 matrices in a file, I have the error "Not enough memory", although I still have 400 KB free. (40 5*5*4 matrices should create a file of size 40000 bytes)

From my experience: more than 10KB crashes execution... ok.. I can do it other way, this time.. but soon maybe not and then it will be problem... build in data swapping would be good way. There could be one file for this in this new Lua folder

This is becoming a real problem :(
When writing in a file, all the things you "write" are actually kept in memory, and it is only written in a real MEM file when the file is closed. Thus, you need a free memory space of twice its size when you write its content.

But Tom, 10 Kb shouldn't cause much problems :huh: Could you please send me a (short) exemple of program that causes this error?

To everyone: If you think that a program is not running correctly, or if you encounter too many problems with memory etc, please send me a program that reproduces your problem, and I will see what's exactly happening with it.

#559 -Tom-

-Tom-

    Casio Freak

  • Members
  • PipPipPipPip
  • 104 posts
  • Location:Poland
  • Interests:Tides, Celestial Navigation, Deadreckoning

  • Calculators:
    Cla$$pad 300

Posted 26 March 2006 - 10:02 AM

I have prepared recently file containing large arrays of data, I had to use scaner and OCR fort his becouse writing it on keyboard would be very stupid. First proble I encountered was too small allowed Lua file size... ok, I didvided data into smaller files... then when I typed and run require "file1 (2,3)" in main program Class pad rised error Stop, stop.. too much for me! For the moment it not great problem for me becouse I managed to handle those files and to read data in appriopriate order... its quite uncomfortable even thought faster.... sorry but now it will be quite time-consuming reproducing this error while Im really busy last days.

#560 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 26 March 2006 - 12:11 PM

Just a note though: remember, the ClassPad is only a calculator, not a Pocket PC :lol:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users