Search found 12 matches

by a7s1h1
Tue Jun 18, 2013 11:25 am
Forum: Support and Development
Topic: Your own error
Replies: 5
Views: 2379

Re: Your own error

micha wrote:You can use the commands error and assert. See in PiL.
Thanks, that's exactly what I need!
One more question. When an error appears, can I somehow write the text of the error to the error log file (error**.txt, where ** is a consecutive number of a file)?
by a7s1h1
Tue Jun 18, 2013 10:54 am
Forum: Support and Development
Topic: Your own error
Replies: 5
Views: 2379

Your own error

Is there any way to crash the game with an error manually (with your own error message text)? I mean something like that: if a==0 then <game crashes and the error message appears with the text "Error! a=0"> end This can be useful to check the code during running the game. So is that possib...
by a7s1h1
Mon Jun 17, 2013 1:07 pm
Forum: Support and Development
Topic: What is the default line break size?
Replies: 5
Views: 4295

Re: What is the default line break size?

Seems that I've found the answer. I just had to multiply the Font:getHeight by the number of lines. Thus 14*1=14, 14*2=28 etc. So, I guess, the margin of each of the line is 1px from each side. Anyway, thats enough to make the text box borders depend on the text block size properly. Thanks for the h...
by a7s1h1
Mon Jun 17, 2013 12:59 pm
Forum: Support and Development
Topic: What is the default line break size?
Replies: 5
Views: 4295

Re: What is the default line break size?

bartbes wrote:I think [wiki]Font:getHeight[/wiki] includes this, too.
Nope, unfortunately. Whenever I have 1 or two lines the height is still 14 (with 12 size font)
by a7s1h1
Mon Jun 17, 2013 11:47 am
Forum: Support and Development
Topic: What is the default line break size?
Replies: 5
Views: 4295

What is the default line break size?

Is there any way to find out the default distance between the lines in a wrapped text? I'm making the text box, which size depends on the width and the number of lines of the text. In order to calculate the required height of the box, I use the following formula: Number_of_lines*Font_size+(Number_of...
by a7s1h1
Fri Jun 07, 2013 2:59 pm
Forum: Libraries and Tools
Topic: [Library] anim8 - An animation library - v2.3.0 released
Replies: 84
Views: 130233

Re: [Library] anim8 - An animation library - v2.0.0 released

I'm facing one more issue. There is some object, which has a random animation from time to time (just like in many platformer games, when you don't touch any key for a while). The problem is that sometimes my animation timer turns on at the time unknown to me and after it reaches 0, it triggers a ne...
by a7s1h1
Thu May 30, 2013 3:21 pm
Forum: General
Topic: calling a function from an argument of another function
Replies: 7
Views: 5251

Re: calling a function from an argument of another function

Now I understood! :awesome: For example, if I create these two functions function print(text,x,y) love.graphics.setFont(font) love.graphics.print(text,x,y) end function performfunction(func,ar1,ar2,ar3) func(ar1,ar2,ar3) end Then calling performfunction(print,'It works!',300,200) will perform functi...
by a7s1h1
Wed May 29, 2013 8:09 pm
Forum: General
Topic: calling a function from an argument of another function
Replies: 7
Views: 5251

Re: calling a function from an argument of another function

function factory(text) return function() print(text) end end Well, I see, I can set an argument of a function2 as an argument of a function1, which runs the function2. But what if the function does not have any arguments? How can I call it from another function? (The issue is not about printing fun...
by a7s1h1
Wed May 29, 2013 1:09 pm
Forum: General
Topic: calling a function from an argument of another function
Replies: 7
Views: 5251

calling a function from an argument of another function

Is it possible to call a function from an argument of another function, like this: ? function love.load() tmr=4 end -- function "timer" is called from love.update(dt): -- The function print('Hi') prints the word "Hi" function love.update(dt) timer(tmr,print('Hi'),dt) end -- the t...
by a7s1h1
Mon May 27, 2013 11:07 am
Forum: Libraries and Tools
Topic: [Library] anim8 - An animation library - v2.3.0 released
Replies: 84
Views: 130233

Re: [Library] anim8 - An animation library - v2.0.0 released

onloop is just what I needed, thanks a lot!!! :awesome: