Project: Cplua
#561
Posted 26 March 2006 - 11:35 AM
#562
Posted 26 March 2006 - 12:51 PM
#563
Posted 26 March 2006 - 01:16 PM
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"
For example, I'm writing a program which uses "resource files" which contain pictures, or user-defined libraries. This would be great if the source code and the resources were compiled into one file (like a .EXE). So there would not be folder name problems, accidentally deleted resource files, etc...
#564
Posted 30 March 2006 - 10:01 PM
I hope that understand me
#565
Posted 31 March 2006 - 12:22 PM
#566
Posted 31 March 2006 - 03:08 PM
but since Orwell introduced IO library PICT Convert is obsolete.. read more about Lua functions in "functions.txt" included in every new Lua package.
Moreover, Lua Pict Convert is completely unusable!
#567
Posted 04 April 2006 - 04:28 PM
-----------------//
(immediately)
I use "toPol" (CAS function) to convert from rectangular to polar coordinates... but when I use "cas.elem(vector,1,2)()" I get error becouse angle is displayed with "<" angle sign... so I cannot use it later for calculations... any ideas?
#568
Posted 04 April 2006 - 08:40 PM
function toPol(x,y) local r,t r=math.sqrt(x^2+y^2) t=math.acos(x) return r,t end
#569
Posted 04 April 2006 - 09:53 PM
Do you really need CAS for that?
function toPol(x,y) local r,t r=math.sqrt(x^2+y^2) t=math.acos(x) return r,t end
I have here whole string of CAS calculations... I wouldnt like to mix this all. Not always easiest way is best
#570
Posted 04 April 2006 - 10:30 PM
t=math.atan(y/x)Nice try
I'm sorry Tom I never use this function "toPol", and I have no idea of solution to your problem
#571
Posted 05 April 2006 - 11:35 AM
Ahem
t=math.atan(y/x)Nice try
Oops, sorry, as I never use toPol, but usually toRect, I mixed the both functions! (x=r*math.cos(t))
#572
Posted 05 April 2006 - 01:34 PM
#573
Posted 05 April 2006 - 09:50 PM
I know that it's still supposed to be a RC version (the last one before CPLua 0.8 final ) which only fixes some last small bugs, but I couldn't resist the temptation of adding the "debug" package
It's now possible to enter interactive mode by calling debug.debug() (or simply debug()). This gives you full access to all functions and variables (even local variables and upvalues)
All functions of the "debug" package may be used to obtain informations about a function, the environment, the metatables, the register etc (see the Lua 5.1 Manual for details).
However, I don't think that I will keep the two functions debug.sethook() and debug.gethook()... They could be useful (for example to execute some code line by line and trace the results), but the problem is that CPLua is already using a special hook to handle external events like key press, button/menu press, screen updates etc... And it wouldn't be a good idea to replace it by an ordinar Lua function, even for debugging purposes
Maybe I will find an alternative, but for now these 2 functions will be unavailable.
Oh, and I also improved the input() function a little bit
#574
Posted 06 April 2006 - 12:44 PM
Everybody wants a debugger, even a simple one . I hope that the Lua 5.1 manual explains how variables are accessed in debug mode, especially local or global variables with the same name (but different scope).I couldn't resist the temptation of adding the "debug" package
It's now possible to enter interactive mode by calling debug.debug() (or simply debug()). This gives you full access to all functions and variables (even local variables and upvalues)
Although I'm very busy these days, I'm curious to see how the debugger works...
#575
Posted 06 April 2006 - 01:04 PM
It contains several bug fixes from RC3, but also many additional features that were missing in previous versions:
-> The "debug" package is available Please refer to the Lua 5.1 Manual for details about its functions.
I must give 2 precisions though:
1) debug.sethook() and debug.gethook() are not available (for the reasons I mentioned earlier)
2) debug.debug() has been slightly modified for CPLua:
a. you may call debug() directly instead of debug.debug().
b. you may also give some arguments as parameters, which will be printed before entering the interactive mode.
c. pressing the "Break" button in the menu returns to normal execution ("cont" also terminates the debug mode)
-> There are 4 new useful functions: setdate(), getdate(), settime() and gettime().
They are available by default. Refer to the file functions.txt for documentation
-> The functions to iterate over files and folders have been improved. There is now a function io.folders() to iterate over folders, and the function fold:content() has been renamed in fold:files().
I added a small example "Files" in the file examples.mcs to show how to use them.
-> The function "input()" now accepts a string as parameter, which is displayed at the left of the input field. For example, you could pass something like "name:" or "X=". This function doesn't return unless the user has entered a valid string (it must have at least one character)
-> You may type "exit" in interactive mode to close it.
-> require() now return itselfs at the end of its execution, and accepts several arguments. This makes it possible to write
require("table", "string", "foo/bar")or
require "table" "string" "foo/bar"
-> ... I think I forgot something... nevermind.
As allways, I'm waiting for your comments before releasing CPLua 0.8 final
In the meanwhile I think I will start writing some documentation for CPLua.
#576
Posted 08 April 2006 - 09:34 AM
Edit: I found (and fixed) an annoying problem with doscript(), which raised fatal exception. The archive has been updated.
#577
Posted 08 April 2006 - 12:33 PM
Edit: I found (and fixed) an annoying problem with doscript(), which raised fatal exception. The archive has been updated.
There is also the same problem with require(), did you correct it too? When you write require("test") or doscript("test"), it raises a fatal exception, but if you write require("main/test") or doscript("main/test"), it works.
Edit: There is also this bug with pict.load (and maybe pict.save)
#578
Posted 08 April 2006 - 12:42 PM
Argh, I fixed this for doscript, I didn't see that there was the same problem with require.There is also the same problem with require(), did you correct it too? When you write require("test") or doscript("test"), it raises a fatal exception, but if you write require("main/test") or doscript("main/test"), it works.
Edit: There is also this bug with pict.load (and maybe pict.save)
Could you give me more details about the problem with pict.load?
#579
Posted 08 April 2006 - 01:04 PM
Could you give me more details about the problem with pict.load?
For example you have a picture "main\pict1". If you write p=pict.load(pict1) it raises a fatal error.
I didn't try with pict.save...
But io functions seem to be ok.
Edit: io.file don't support names with multibyte characters It's not important for me,but I noticed that.
#580
Posted 08 April 2006 - 03:45 PM
I didn't find any problem with pict.load() however
#581
Posted 08 April 2006 - 09:52 PM
I have a problem, I?m coding a program that have a user graphic interface, a picture background with buttons that the user can press with stylus.
When the user press the buttons (with waitpen()), the console appears with the command input(), the problem is that when i put values, the program doesnt return to graph mode correctly. .(must be!)..returns..but in a blink! and skip the waitpen() command. this job is done in a repeat loop. i played with all!! showconsole, showgraph, draw.update and so on. an it does?t work!!! .
this is the pseudo code
repeat showgraph() x,y=0,0 mainmenu() //routine that draws the pict x,y=waitpen() // this waitpen is skipped before 2 or 3 button entries!!! type=gtype(x,y) // this function does a relationship between the buttons and the screen // coordinates...some concatenated if-then-end, no more if type==1 then showconsole() clear() list=input("enter values") end until type==0 // type is from zero to 9, if i press escape on screen, type is zero another modification is with mainmenu() out of the loop an the draw.update() command in the loop
this "skipping" of waitpen is a bug? or i?m done a bad code?
a post about a problem as this: http://www.casiocalc.org/?showtopic=2447
thanks for your info orwell
#582
Posted 08 April 2006 - 10:17 PM
The fact is that CPLua receives a signal "pen down" at the first time you use the pen, but it never receives the signal "pen up" because the current window (the graph window) is quickly replaced by the other one (the console window) which does not track the pen... Thus CPLua "believes" that the pen is still on the screen
Handling with several windows is really tricky. I found a workaround by forcing CPLua to consider that the pen is immediatly removed after the call to waitpen(), but I'm not sure that it won't cause some other problems
I will make another update soon and let the lua users try it
By the way, I'm also working on a graphical using interface for CPLua (the "ui" package), but with real window, buttons etc
#583
Posted 09 April 2006 - 10:03 PM
I will make another update soon and let the lua users try it
By the way, I'm also working on a graphical using interface for CPLua (the "ui" package), but with real window, buttons etc
Thanks orwell ...i would commit a suicide! (joke!) , the UI seems to be powerful, yesterday was trying to code an "array editor", works fine at moment,as spreadsheet, with custom table properties (cellwidth and other ones..). At now i?m using waitkey() with no problems . but i don?t know how to implement scrollbars, i need to do picture manipulation as pic.part()?, (as seen on your "logotile" example? i wasn?t read the code, is only a supposition)
other question: In my array editor i need to erase screen zones repeatedly, I now using pict.new(w,h), then i draw the same picture many times in the same zone (this is used to display the current cell ), this methow waste too much memory??, can Lua crash because an insufficient memory?, the graphs buffer store info in "layers" (all drawing operations in a sequence) 0r only a 160x240 bitmap that shows the actual screen state ?
Thanks for your info,
#584
Posted 10 April 2006 - 10:03 AM
Well, it doesn't sound easy to do.... You could deal with pictures indeed, but I can't think currently of a good way to do iti don?t know how to implement scrollbars, i need to do picture manipulation as pic.part()?,
Drawing operations do not allocate memory. But pict.new() creates a new picture, and of course it needs memory for that... Do you really need to create a new picture each time? Note that the allocated objects (tables, pictures) are "unallocated" once you don't use them anymore, thus if you create a new picture, draw it, and lose reference to it, it will be destroyed laterIn my array editor i need to erase screen zones repeatedly, I now using pict.new(w,h), then i draw the same picture many times in the same zone (this is used to display the current cell ), this methow waste too much memory??
a = pict.new(10,10) -- first pict a = pict.new(10,10) -- second pict, lose the first pict ... -- do some instructions draw.pict(x,y,a) -- the second pict is still there -- but the first pict has been silently destroyed because there was no reference to it anymore
If there is not enough memory, the Lua program will break. There shouldn't be a crash of CPLua - but if it happens, please report itcan Lua crash because an insufficient memory?
The buffer is a simple 160x240 pict indeed... You could use any picture as buffer instead by the waythe graphs buffer store info in "layers" (all drawing operations in a sequence) 0r only a 160x240 bitmap that shows the actual screen state ?
To everyone: I understand your motivation, but please don't make too much efforts to implement some new UI elements like buttons, scrollbars etc... I'm already working on something that will be quite more powerful
Here is an example of code (it's already working here) for the next versions after CPLua 0.8 (but it won't be available before a couple of weeks, sorry ):
require "ui" w = ui.window("A window", 30,20,100,140) b = ui.button("Say Hello",10,10) w:add(b) b2 = ui.button("Quit",10,30) w:add(b2) function b:_clicked() print("hello!") end function b2:_clicked() ui.stop() end w:show() ui.exec()This is only a very small example of the features of the "ui" package.
Please be patient, this should be a great package
#585
Posted 10 April 2006 - 10:59 AM
Wow! It will be that easy? You can even define actions, such as button_clicked, combobox_modified (or something similar)? Ideal for menus, "settings" or "options" windows. Plenty of game developers will be satisfied, but it will be also useful for my "driver" LuaNumAn programs (not for the core of LuaNumAn though).This is only a very small example of the features of the "ui" package.
Please be patient, this should be a great package
However, if you add the "ui" package in version 0.8, there will be release candidates 5, 6, 7, ...., since it will need heavy testing.
Btw, I'm planning to write a "LuaTest" benchmark program, which will use LuaNumAn numerical methods to solve some time consuming problems, compare the results with a data file (to test efficiency) and measure the computation time. It will be very useful for testing new versions of CPLua.
#586
Posted 10 April 2006 - 11:55 AM
That's the goal It will take time though, because there are a lot of features to implement, but the basis are already set and work correctlyWow! It will be that easy? You can even define actions, such as button_clicked, combobox_modified (or something similar)?
This package is planned for CPLua 0.9, I'm currently working on a parallel version for my tests with this package I will wait a couple of days to let the users test CPLua 0.8 RC4 and report some last bugs if needed, then I will truly release CPLua 0.8. I think that there are already a lot of new things since CPLua 0.72However, if you add the "ui" package in version 0.8, there will be release candidates 5, 6, 7, ...., since it will need heavy testing.
Indeed, that should be quite usefulBtw, I'm planning to write a "LuaTest" benchmark program, which will use LuaNumAn numerical methods to solve some time consuming problems, compare the results with a data file (to test efficiency) and measure the computation time. It will be very useful for testing new versions of CPLua.
#587
Posted 19 April 2006 - 06:04 PM
It is available here.
After a long wait, and a lot of beta versions/improvements/bug fixes, here is the last stable version of CPLua.
Here is a summary of the main (visible) improvements since CPLua 0.72:
- upgrading from Lua 5.0.2 to Lua 5.1
- "io" package
- pictures related functions in the "draw" package
- "debug" package
- the key [<-] may be used to found errors in a script
- file "CPLua/Prefs" used to save preferences
Have a lot of fun with it!
PS: Btw, if someone is interested in translating CPLua in another language (like Spanish), just let me know! There is only 20 lines to translate
#588
Posted 19 April 2006 - 09:02 PM
CPLua 0.8 is finally out!
PS: Btw, if someone is interested in translating CPLua in another language (like Spanish), just let me know! There is only 20 lines to translate
OK, I'll try. Could you post the lines to be translated?
Thanks for all the work.
Just a curiosity. Why did you started to develop CPLua?
Rafael
#589
Posted 20 April 2006 - 07:37 AM
#590
Posted 26 April 2006 - 02:24 PM
I`m finishing my array editor for CPLua 0.8 but i have a small bug (me or CPLua, i don`t know)
the grid and cursor displacement (as CP spreadsheet), is coded and works fine. i have a function that draw on hidden buffer the lines of the grid contour. then i use pict.buffer() to store te buffer on a pict called "grid"
grid is drawn on the screen when i need. then when i attempt to draw numbers other function draws a white picture with the cell size in the current cursor position (to erase it). then the number is drawn with draw.text().
All the screen zone on the top and left of the point on the p?cture is drawn,moves 1 pixel to the left!!!! (as i used part.pict() command!!!),i need to solve this because this generates a double-thicked lines on the bottom of the number drawn following the column to the bottom of screen.this lines are the borders of the "two" separated screen sectors
the curious thing is when i press keyboard on the hard keypad...Voilaaa!! the bug is fixed and the screen sector on left returns 1 pixel to the right
another clue: this lines appears just when i load the"erasing" picture on the cell, before num drawing. if i skip this step, the num is drawn without problems but i can`t do corrections and erasings..
ps: Can the "ui" pack perform popups to imput values on showgraph() mode? where are the documentation to see the syntax of every function?
thanks a lot for your help
#591
Posted 26 April 2006 - 03:36 PM
>> rafapa:
mastermage (another programmer) already thought long ago about porting the Lua interpreter on the ClassPad, but he never had the time to make it. Then I decided to see by myself how this could be done, and here is the result
>> AFX Master:
Hmm, I think that this problem actually comes from CPLua. But I will soon have to make some modifications on the "draw" window, and maybe it will solve your problem too. We will see how it goes with the next version
Btw,
Perhaps you could first create the pit "grid" and draw the grid on it directly (with draw.onpict(grid) instead of draw.onbuffer())i have a function that draw on hidden buffer the lines of the grid contour. then i use pict.buffer() to store te buffer on a pict called "grid"
#592
Posted 26 April 2006 - 10:07 PM
It is now also possible to manipulate the 2 standard windows (the console and the draw window):
require "ui" print("Resizing the console") c = ui.getwin("Console") c:resize(20,20,100,100) waitkey()I let you imagine what we could do with this
#593
Posted 27 April 2006 - 09:28 PM
. Is there any change with the Camparition of a number with nil?
the thermodynamic tables contain nil values by deafult and
I should find a way to compare number with nil .
( I mean version .8 final)
. Is there any change in the printf Function?
run my "CATT/PsatV" program to see the error!
when I use the same statement in a new program there will be no error.
thats strange!
(I think it refers to the above problem)
any help/suggestion?
. Also write a single statement program with the printf function . the "Done"
word will follow the printf and do not go to the next line.
#594
Posted 27 April 2006 - 10:30 PM
I Do not know if a Persian font (character set) will be posible or not .
If the font does not mater . So send me the Translation code too.
I hered that making the peg fonts is so simple , If it is so , the Tahoma Font in
the Windows Xp is good for Persian .
( If in your mind making peg fonts from windows fonts is not simple so send me a pm)
Thanks.
#595
Posted 01 May 2006 - 08:59 PM
Gracias
#596
Posted 01 May 2006 - 09:46 PM
I don't know, maybe search "Lua" on Google....
#597
Posted 03 May 2006 - 01:50 PM
#598
Posted 03 May 2006 - 02:56 PM
require "draw" print("Hello") draw.line(10, 10, 20, 20) draw.line(10, 10, 20, 20) draw.line(10, 10, 20, 20) waitkey()
A line is drawn on the console window! If you draw it 2 times, it won't work, you have to draw it 3 or more times. Really strange...
#599
Posted 07 May 2006 - 04:25 PM
consider a file containing a table :
File A:
a={1,2,3,4,5} export{a=a}
File B:
require("fileA") require("table") print(table.getn(a))
Output=0
why?
#600
Posted 07 May 2006 - 04:38 PM
consider a file containing a table :
File A:
a={1,2,3,4,5} export{a=a}
File B:
require("fileA") require("table") print(table.getn(a))
Output=0
why?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users