2 Question : Hidding code , and help for another things...

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

Moderators: Shine, Insert_witty_name

Post Reply
spyk
Posts: 14
Joined: Wed Mar 22, 2006 9:50 pm

2 Question : Hidding code , and help for another things...

Post by spyk »

Hi all :

1°/ How can we Hide Lua source code?
Because it's note cool, when you're programming a little network game, and user can easy cheat with source code...

2°/ In this tutorial : http://wiki.ps2dev.org/psp:lua_player:tutorial

I have'nt understant this :

Code: Select all

function drawTile(tile, x, y)
	local tileX = math.mod(tile, 4)
	local tileY = math.floor(tile / 4)
	screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)
end	

Pecisely this :

Code: Select all

	
screen:blit(16 * x, 16 * y, tiles, 17 * tileX + 1, 17 * tileY + 1, 16, 16, false)

16*x and 16*y, OK that's the coordinates where the tile while be draw.
17*TileX +1, 17*TileY, What's this? The coordinates where the tile while be taken in the picture? Why 17*? why +1?

and this : 16, 16, false ?

Sorry, I havent found help for this function.

and why local tileX = math.mod(tile, 4)
local tileY = math.floor(tile / 4)
? Can you tell me about this?
I've found help for math function hier http://lua-users.org/wiki/MathLibraryTutorial but...


Thank you!!
ShUr1k3n
Posts: 42
Joined: Sun Oct 16, 2005 9:04 pm

Post by ShUr1k3n »

1º - How to Hide source Code in Lua ? -> Use the Search in this forum
2º - Look at this:

Code: Select all

nil image:blit(x, y, Image source, [sourcex, sourcey, width, height], [alpha = true])
"Paints the image, which is specified as “source” to the image on which this function is called on (or to the double buffered screen, when using the “screen:blit(...)” variable, which is a special image). “sourcex” and “sourcey” is the position in the source image, from where a rectangle of the size width/height is copied." <- http://wiki.ps2dev.org/psp:lua_player:f ... s#graphics

Take a look at http://wiki.ps2dev.org/psp:lua_player#psp_lua_player and u will understand the "local", "math.floor", etc...

Regards,

ShUr1k3n
spyk
Posts: 14
Joined: Wed Mar 22, 2006 9:50 pm

Post by spyk »

OK, thank for all!
glynnder
Posts: 35
Joined: Sun Sep 04, 2005 9:54 pm

Post by glynnder »

yea, dont forget to use search, in fact i may search tha\t just now
glynnder
Posts: 35
Joined: Sun Sep 04, 2005 9:54 pm

Post by glynnder »

i couldnt find anything in search - can anyone shed some light?
Slopey
Posts: 24
Joined: Sun Jul 31, 2005 8:13 pm

Post by Slopey »

I asked the same question a while back (and the search you need to do isn't particularly obvious). However, if you want to hide your code, your only option as I understand it is to compile it into a version of the player manually. Seemingly there are hints on how to accomplish this in the docs with the player source.

It might be possible to do something more cunning now that v19 supports modules, but you'd have to write those portions in C afaik.

Cheers,
S.
glynnder
Posts: 35
Joined: Sun Sep 04, 2005 9:54 pm

Post by glynnder »

how would i build it into my eBOOT?
I can't have v0.19 - im on 2.6
Slopey
Posts: 24
Joined: Sun Jul 31, 2005 8:13 pm

Post by Slopey »

You can do it with any version of LuaPlayer - you recompile the player itself to load your application when it starts. Seeminly it's in this documentation for the LuaPlayer source.
Post Reply