Lua Player WiKi

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Lua Player WiKi

Post by Shine »

I've created an entry in the ps2dev Wiki for Lua Player (follow the Lua Player link) :

http://wiki.ps2dev.org/

Everybody can edit it, after registering at the Wiki system. Maybe this is useful for not to forget important things in a stream of forum posts and to collect other important information about Lua Player, game projects etc.
User avatar
JoshDB
Posts: 87
Joined: Wed Oct 05, 2005 3:54 am

Post by JoshDB »

You should enable HTML for easy jump-to code and text coloring effects.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

here is an tutorial how to edit wiki
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
jimjamjahaa
Posts: 17
Joined: Mon Oct 03, 2005 5:00 am

Post by jimjamjahaa »

over the years i have made lots of scripts for game dev. i ported over one of the most useful functions ever. here it is, i hope someone could put it in the wiki (i cant be bothered to learn how)

Code: Select all

    -- you need to set pi as a global variable = to pi
function point_direction(x1,y1,x2,y2)
    _x = x2 - x1
    _y = y1 - y2
    if _x == 0 then
        if _y == 0 then
            return 0
            end
        if _y > 0 then
            return 90
            end
        if _y < 0 then
            return 270
            end
        end
    _i = math.abs&#40;_x&#41; + math.abs&#40;_y&#41;
    _x = _x / _i
    _y = _y / _i
    
    rd = math.atan&#40;_y/_x&#41;
    
    if _x <0 then
        rd = rd + pi
        end
    
    if _x > 0 and _y < 0 then
        rd = 2*pi + rd
        end
  
    return rd * 180 / pi
    end
by the way, what is the square root function in lua?
Last edited by jimjamjahaa on Fri Oct 07, 2005 6:14 am, edited 2 times in total.
LuMo
Posts: 410
Joined: Sun Aug 21, 2005 2:45 am
Location: Austria
Contact:

Post by LuMo »

google says what i expected it to say... math.sqrt()
"Good artists copy, great artists steal."
Pablo Picasso
go2lumo.com
jimjamjahaa
Posts: 17
Joined: Mon Oct 03, 2005 5:00 am

Post by jimjamjahaa »

chrz. yeah i shud have googled.... meh
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

jimjamjahaa wrote:function point_direction(x1,y1,x2,y2)
Nice, but you should take a look at Math.atan2 :-)
jimjamjahaa
Posts: 17
Joined: Mon Oct 03, 2005 5:00 am

Post by jimjamjahaa »

eek! dont tell me i did that for nothing!? oh well.

where do you find documentation on the math library. on the official lua site it didnt go over it in any detail
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

jimjamjahaa wrote:where do you find documentation on the math library. on the official lua site it didnt go over it in any detail
http://lua-users.org/wiki/MathLibraryTutorial
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

If you goodle the site, use the following and you'll find what you want.

site:http://lua-users.org/wiki/ math

or use any other searching word(s) you want in the place of "math".
Geo Massar
Retired Engineer
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Post by Shine »

I've added the tutorial to the Wiki, feel free to enhance it like you want, I think it needs some more explanations for example for the Pac Man game and maybe you want to fix my grammar, spelling and bad English erros, which I'm sure are in the text. I've deleted JoshDB's code, because it was nearly the same as the sample in the tutorial for the analog pad. And don't forget to use the nice

Code: Select all

 feature for syntax highlighting Lua code :-)
Post Reply