Jump to content


lukasloko's Content

There have been 27 items by lukasloko (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#245021 split string using words

Posted by lukasloko on 07 February 2016 - 01:42 AM in Ask a Pro

Hmmm, that could work the way that i'm looking for. I will try thank you for the hint



#245019 split string using words

Posted by lukasloko on 07 February 2016 - 01:26 AM in Ask a Pro

I already made some question about that kinda of stuff some time ago, but only now i'm having problems and question about that again.

I'm making routers and programs that communicate with others programs. The programs need to split the messages that they receive from the others into blocks (like password$nickname$balance$status) and then process it. And I have not much more characters to use as split pattern without overlapping.

My question is:

Can you split strings using words like:
Spoiler
Output:
Spoiler

maybe it has a easy awsner but i'm not able to figure out it.



#239526 Browser ,Web Server and DNS

Posted by lukasloko on 02 December 2015 - 02:48 PM in APIs and Utilities

The new animation tutorial file for the browser 4.2 with the infinity frames feature is here :D http://pastebin.com/M3Qu5xzp

I really want to those files help with the setup of the features of my programs , I hope you guys understand how to make every thing on the browser to work properly. So I'ill make a question, do anyone here tested the program already?????



#238033 Browser ,Web Server and DNS

Posted by lukasloko on 15 November 2015 - 02:43 PM in APIs and Utilities

Thanks for help , i ill folow the tips :D



#236300 Browser ,Web Server and DNS

Posted by lukasloko on 25 October 2015 - 09:55 PM in APIs and Utilities

View PostWait_, on 25 October 2015 - 01:17 AM, said:

for a first program? this is AWESOME! with my first program, it wasn't really that good compared to what you can do ;)
can you give me any hints about my program, you have already tested it ?



#236232 Browser ,Web Server and DNS

Posted by lukasloko on 25 October 2015 - 01:21 AM in APIs and Utilities

Thank you :D , i learned here in this forum to do what i have did



#236178 Browser ,Web Server and DNS

Posted by lukasloko on 24 October 2015 - 04:30 PM in APIs and Utilities

This is my first project and I'm a NEWBIE on programming so be patient .

The Browser:

Is the client side program that acess and process all the information that the servers send to it,

Features

The web Server:

Is the server that send the information to the client browser.

Features

The DNS Server:

Is the server that receive from the browser the domain name and the info, process into a id, and resend the info to it

Features

How it works:

Spoiler

Files:
Animation tutorial file: http://pastebin.com/M3Qu5xzp (4.2)
Link tutorial file : http://pastebin.com/QEgH3bLA
Browser: http://pastebin.com/jUHvvXV9 (4.2)
DNS : http://pastebin.com/106FGE59
WebServer : http://pastebin.com/7LbZkxZc

OldFiles

Screenshots:

Attached Image: Browser.png

Video:

(**comming soon, maybe**)

Terms:

You can make videos with it , make alterations and whatever you want, but please, refer this topic if you can,
You can and should use this to learn and make your own project without refer me, just refer me if you are using the program that I do.
Please, if you think I do something wrong , help me, this is a community and we are here for this.
Contact (skype): lukasloko7

PS:

I am not american, so sorry for my bad english

If you can , comment what you think about this, give me hints :D.



#229082 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 10:30 PM in Ask a Pro

View Postflaghacker, on 05 August 2015 - 08:29 PM, said:

Is your question actually "how do I check on what text the user clicked on the screen"? If so, that's impossible. You should keep the coordinates of printed text yourself, and then use the data of the mouse_click event to find out what text was clicked.

View PostMKlegoman357, on 05 August 2015 - 08:41 PM, said:

View Postflaghacker, on 05 August 2015 - 08:29 PM, said:

Is your question actually "how do I check on what text the user clicked on the screen"? If so, that's impossible. You should keep the coordinates of printed text yourself, and then use the data of the mouse_click event to find out what text was clicked.

It is possible, but as flaghacker pointed out, it's something that won't work that great. You would actually want a system that's more advanced than this. You could go with how HTML does this (and many other GUI frameworks), by having each object (a button, textbox or simply text) be a separate object. I'm talking about an Object-Oriented Programming (OOP) approach. It's really something that might not be as easy as you might expect, so my suggestion would be to first make some simpler programs, like a door lock with clickable buttons on a monitor. Also, you could look and see how different button APIs handle buttons.
I am tryng to find a word coordenates and then check if the cursor clicked on it



#229052 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 07:14 PM in Ask a Pro

View PostTheOddByte, on 05 August 2015 - 05:42 PM, said:

Hmm.. So you'd probably want todo something like this
--# Store all lines in a table
local lines = {}


--# Get all the lines from the file
local file = fs.open( "<your file>", "r" )
for line in file.readLine do
	table.insert( lines, line )
end


--# This function will loop through all the lines
--# And check if it can find the specific word in any line
--# It will return a table like this: { x1 = 1, x2 = 2, y = 1 }
local function find( word )
	local results = {}
	for i, v in pairs( lines ) do --# Loop through all the lines
		if line:find( word ) then --# Check and see if you can find the specific word in the line
			local x1, x2 = line:find( word ) --# Get the first and last position of the word
			table.insert( results, {
				x1 = x1;
				x2 = x2;
				y  = i;
			})
		end
	end
end

local results = find( "Hello" )
print( textutils.serialize( results ) )
This is just an example, if you understood what I did here then it can probably be helpful to you, the question is, do you want to find a word by it's position? or do you want to search for it as a string( string.find( str, str2 ) )


Edit: Try creating a file and put some random text in it, and put Hello somewhere in it and see if it returns the result you expect it to return
Have an error on the line if line:find( word ) then or its me?



#229046 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 05:43 PM in Ask a Pro

I want to find the word position, the word is always random, but I have a code after and before it ,that i find the position and i can calcutate where is to the mouse click



#229044 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 05:35 PM in Ask a Pro

The question is : the function string.sub() know when the word are on onother string or it simple resume counting normaly?



#229043 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 05:29 PM in Ask a Pro

Ok , I ill try to explain better , I m not American,so if I write somethings wrong , sorry..
Here is:
I making a web browser, and to add a click support , to click on the screen on a text and go to an other link, I need the browser to scan for a especific word, and then see the X and Y pos of it, if you click in the pos you go to the link, and I having problems with this code because the X pos is a little strange of the supposed to be.I think is because the function don't know when the string is on another line.



#229041 How to "read" a line by it pos

Posted by lukasloko on 05 August 2015 - 05:15 PM in Ask a Pro

But this will give the exactly position like:

archive1 :
hey i am
a archive
and i have
words on
lines
---------------
code:
function that reads the archive1 and prints on the screen
----------
the X will reset to one at each line end?
if you don't understand i can try to explain again.



#228978 How to "read" a line by it pos

Posted by lukasloko on 04 August 2015 - 11:40 PM in Ask a Pro

Oh thanks , I have already saw the string sub but I not find so much info of it.



#228975 How to "read" a line by it pos

Posted by lukasloko on 04 August 2015 - 11:20 PM in Ask a Pro

Sorry if this is a obvious question but I really don't find on anywhere.
I need to "read" a line by it pos , like this:

str = "why you do that?"

3rd_word = findbypos(9,10)

print(3rd_word)

return:

"do"



#228964 Fiend a word position on a string

Posted by lukasloko on 04 August 2015 - 07:58 PM in Ask a Pro

I think that will work thanks.



#228962 Fiend a word position on a string

Posted by lukasloko on 04 August 2015 - 07:44 PM in Ask a Pro

I am trying to make a code that , reads a string and find a word and the position of it then return the position..
I have no idea how I can do that, so i have no code here...but this may express what i mean:

str = "I have no idea,"
X,Y = function_that_I_am_trying_to_do(word:"no")
print(X,Y)
return:
7,1
I ill appreciate your help.



#222898 Split string(with a designated way to separete)

Posted by lukasloko on 23 June 2015 - 05:57 PM in Ask a Pro

ok , it works , thanks



#222895 Split string(with a designated way to separete)

Posted by lukasloko on 23 June 2015 - 05:41 PM in Ask a Pro

so with this the result will come in a table?

I need to use the table or i can make with other thing?



#222891 Split string(with a designated way to separete)

Posted by lukasloko on 23 June 2015 - 05:32 PM in Ask a Pro

anything like split string with my , i choice , the term of the separation.

without use a patern like separete with ponctuation by %p



#222888 Split string(with a designated way to separete)

Posted by lukasloko on 23 June 2015 - 05:17 PM in Ask a Pro

I want to split strings , but not with the default paterns like this:

for token in gmatch("lalla", [^%p]+) do
or with %a %c %d %l %w etc...

i want to do that but with a designated patern like this:
(not a real code , you know)

for token in gmatch("la:la\la.la", "\")

then the results will be : la:la and la.la

(sorry for any English error)



#219593 Dns server help!

Posted by lukasloko on 01 June 2015 - 06:03 PM in Ask a Pro

So if a command always return nil , the computer assumes the code got a error?So , thanks for all.. I will repair and reply if i get more errors.



#219364 Dns server help!

Posted by lukasloko on 30 May 2015 - 08:24 PM in Ask a Pro

The error is not a CC default error , is my custom error. The error404() is a function which occurs when: not rednet.send()
And this is the problem , why is not sending the message?

P.S.: If is not what you mean to say sorry, i don't speak English very well..



#219010 Dns server help!

Posted by lukasloko on 28 May 2015 - 03:47 PM in Ask a Pro

I don't think this is really necessary because i don't get what are he talking about... So i make this:
Original:
dns()
--codes
end
error404()
--codes
end
Now:
error404()
--codes
end
dns()
--codes
end
========
So i don't' think is that what he tried to say...
P.S.
the error function are called when
not rednet.send(blabla,blabla)
.

Anyone can explain me better?



#217726 Dns server help!

Posted by lukasloko on 18 May 2015 - 08:25 PM in Ask a Pro

this do not work...