- ComputerCraft | Programmable Computers for Minecraft
- → lukasloko's Content
lukasloko's Content
There have been 27 items by lukasloko (Search limited from 10-February 22)
#245019 split string using words
Posted by
lukasloko
on 07 February 2016 - 01:26 AM
in
Ask a Pro
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:
msg = "I like %word% my computer"
for token in msg:gmatch("[^%word%]+") do
print(token)
end
I like
my computer
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
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
#236300 Browser ,Web Server and DNS
Posted by
lukasloko
on 25 October 2015 - 09:55 PM
in
APIs and Utilities
#236232 Browser ,Web Server and DNS
Posted by
lukasloko
on 25 October 2015 - 01:21 AM
in
APIs and Utilities
#236178 Browser ,Web Server and DNS
Posted by
lukasloko
on 24 October 2015 - 04:30 PM
in
APIs and Utilities
The Browser:
Is the client side program that acess and process all the information that the servers send to it,
*It have a simple GUI
*Home, favorite and refresh buttons that save sites to be accesed later.
*Come back and foward buttons (**not work properly yet**)
*The exit button (X)
*Super basic animation support that have 3 frames (4.1)
*Infinite animation Support ( added on 4.2)
*Infinite links on web basic support
*Basic package sender support
*Do not support scroll yet ( 16 lines are supported )
*Download Support( with warning)
The web Server:
Is the server that send the information to the client browser.
*Other pages support( like myserver/download)
*Package receive and process of it (**you need to create what to do after**)
*Basic server send and receive already done
*Dns protection that can be edited to be deactivated (block connection of the ids not listed)
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
*Blocked id support (need to be edited by you)
*Add and link the domain name with an id (need to be edited by you)
*Basic dns process already done
*Redirect with additional pages support(like yoursite/mysite)
How it works:
The browser just display what the requested site send to it, but to use the supported features of it ( like animation, links and package send ), you need to edit the web pages in the web server.
After downloading the webServer on a computer , you will need to create a file called index ( edit index ), and it will be the home page ( you cannot open the webServer without it), after doing this you will need to write whatever you want in it.
Add other pages: To add additional page you can just create a file with the name of it in the folder of the WebServer ( like edit otherpage, that will be acessed by write yourserver/otherpage in the browser)
Add download content: To do this simple make a page with any name, write on it (without ") "--browser.download=1" and when the page be acessed the download warn will be show.
Add links and packages: To do it you will need to make an info page, that will have the info of the links position , the type of it (package or link ) the background page ( that will be showed) and to what page the browser will go if the link being clicked or to where send the package to be processed. ( more info in the "links and package tutorial page" on the bottom of the page)
Add animation: To do an animation you will need to some pages, that now can be infinity , ( that will be the frames ) and an info page that will be acessed and processed, on the info page you will need to refer the frames and if it will be exec twice.
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
Animation tutorial file: http://pastebin.com/jPMBkUUv (outdated [4.1])
Browser : http://pastebin.com/R79VWam9 (4.1)
Screenshots:
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
#229082 How to "read" a line by it pos
Posted by
lukasloko
on 05 August 2015 - 10:30 PM
in
Ask a Pro
flaghacker, on 05 August 2015 - 08:29 PM, said:
MKlegoman357, on 05 August 2015 - 08:41 PM, said:
flaghacker, on 05 August 2015 - 08:29 PM, said:
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.
#229052 How to "read" a line by it pos
Posted by
lukasloko
on 05 August 2015 - 07:14 PM
in
Ask a Pro
TheOddByte, on 05 August 2015 - 05:42 PM, said:
--# 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
#229043 How to "read" a line by it pos
Posted by
lukasloko
on 05 August 2015 - 05:29 PM
in
Ask a Pro
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
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.
#228962 Fiend a word position on a string
Posted by
lukasloko
on 04 August 2015 - 07:44 PM
in
Ask a Pro
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.
#222888 Split string(with a designated way to separete)
Posted by
lukasloko
on 23 June 2015 - 05:17 PM
in
Ask a Pro
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)
#219364 Dns server help!
Posted by
lukasloko
on 30 May 2015 - 08:24 PM
in
Ask a Pro
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
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?
- ComputerCraft | Programmable Computers for Minecraft
- → lukasloko's Content


