This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
VaNnOrus's profile picture

A Few Questions

Started by VaNnOrus, 24 November 2013 - 02:46 AM
VaNnOrus #1
Posted 24 November 2013 - 03:46 AM
How can I use pcall or something like it when need run the functions from loaded apis files? That is something like
pcall (file.object: func ())

I can't create new topic in Suggestions :(/>
I want to suggest to add cyrillic support, it would be awesome :)/> Для русских-то абсолютно точно :3
Add standard encryption methods (like sha1, md5, etc.)
And add support for the compilation scripts, can sometimes be very useful

Sorry if my english too bad.
MKlegoman357 #2
Posted 24 November 2013 - 07:28 AM
1 - Calling functions from APIs is very simple:


os.loadAPI("myapi") --// Load your custom API

myapi.myFunction() --// Call a function in that API

2 - Forum Guidelines

3 - Some of them are already made as APIs by community and I'm pretty sure that other encryptions could be made too. Also, Immibi's peripherals have a cryptographic accelerator which can encrypt strings.

4 - Sorry, I don't understand what are you talking about.
Edited on 24 November 2013 - 06:31 AM
DannySMc #3
Posted 24 November 2013 - 07:27 PM
well the above guy is right use

os.loadAPI("your_api") -- Replace your_api with your api's name in the file system
-- then to call a function you use the name of your api so if it called light then you will use:
light.encrypt() -- this is a test

actually making a api is different…
here is my example api:

-- My First API
-- Clears the screen
function cs()
  term.clear()
  term.setCursorPos(1,1)
end
-- prints the apis version
function version()
  return "1.1"
end
-- If you wish to add variables that need to be entered you could use:
-- prints certain text you input
function printText(text_to_print)
  print(text_to_print)
end

the first two functions are pretty simple so you can use them in code easily by calling them by using:

os.loadAPI("myapi") -- Loads api so it can be used
myapi.cs() -- loads a function and runs it
-- or
myapi.version() -- returns version so you should normally use the following code as a better way:
print(myapi.version())

the last one needs a variable to function. all it does is print whatever you give it. Examples:

os.loadAPI("myapi")
-- Example 1
text = "Hey Friend"
myapi.printText(text)
-- Output
Hey Friend
-- Example 2
myapi.printText("hello")
--Output
hello

This is all easy to follow if you want more help then just ask and I can send you some tests for you to follow:) danny.smc95@gmail.com

For the other things…it would need to be an api to be honest so to add cyrillic you would need to implement it, also encryption is made by yourself but people have already done it so you download their api and then load it… read the api code first to see what the variables needed are first…

and compilation scripts??
VaNnOrus #4
Posted 24 November 2013 - 07:36 PM
1 - Calling functions from APIs is very simple:


os.loadAPI("myapi") --// Load your custom API

myapi.myFunction() --// Call a function in that API
Read my question!
I ask how call apis function with pcall or something like pcall. I need safe call which no throws error if function return error. Or tell me if this is not possible.


I tell about support cyrillic encode in the mod. About post - I think that one line in Russian in the post does not violate the rules of the forum. This is a small easter egg for the Russian. If you are against - I can delete this row

3 - Some of them are already made as APIs by community and I'm pretty sure that other encryptions could be made too. Also, Immibi's peripherals have a cryptographic accelerator which can encrypt strings.

No one disputes that there is an encryption functions, but I said that would be good to add them to the standard methods of the CraftOS

4 - Sorry, I don't understand what are you talking about.

Script that compiles luac.exe in "lua for windows"
Lyqyd #5
Posted 24 November 2013 - 07:41 PM
Pcall is pretty easy to use, the first argument is the function to call, the remaining arguments are the arguments to pass it. For instance, you could call textutils.serialize:


pcall(textutils.serialize, {"a", "table"})

MKLegoman was linking you to the Forum Guidelines post because you obviously haven't read it, or you'd understand that people in the New Members group aren't allowed to start topics (with the recently made exceptions of Bugs and Ask a Pro sections).

Encryption functions are highly unlikely to ever be added to ComputerCraft itself. There's not really any need for them, so if you feel like you need it, you'll have to add/write your own libraries.

There's no need to add code compilation, but you could always play around with string.dump, I guess.
VaNnOrus #6
Posted 24 November 2013 - 07:59 PM
Pcall is pretty easy to use, the first argument is the function to call, the remaining arguments are the arguments to pass it. For instance, you could call textutils.serialize:


pcall(textutils.serialize, {"a", "table"})

Oh, thanx, I try
pcall(apiname.func)


MKLegoman was linking you to the Forum Guidelines post because you obviously haven't read it, or you'd understand that people in the New Members group aren't allowed to start topics (with the recently made exceptions of Bugs and Ask a Pro sections).

But then where I general could ask for help? Sorry, I did not really read the rules. It is somewhat difficult for me, my knowledge of English is not high, but I understand that this is not an excuse. Why do not you just remove rights on start topic for group of new users?

Encryption functions are highly unlikely to ever be added to ComputerCraft itself. There's not really any need for them, so if you feel like you need it, you'll have to add/write your own libraries.

Okay :(/>

Most importantly suggestion was:

I want to suggest to add cyrillic support, it would be awesome :)/> Для русских-то абсолютно точно :3

what about it?
Lyqyd #7
Posted 24 November 2013 - 08:29 PM
We have removed topic creation rights for the New Members group, which is why you couldn't start a new topic in Suggestions.

Extended character set support for ComputerCraft is something that has been suggested many times, and is something that I think the developers would like to happen eventually, but last I had heard, there are one or two technical obstacles to it actually happening, and I can't remember what they are.
VaNnOrus #8
Posted 25 November 2013 - 09:46 AM
We have removed topic creation rights for the New Members group, which is why you couldn't start a new topic in Suggestions.

Extended character set support for ComputerCraft is something that has been suggested many times, and is something that I think the developers would like to happen eventually, but last I had heard, there are one or two technical obstacles to it actually happening, and I can't remember what they are.
Very sad…
Maybe if the developer will tell what the technical obstacles are community help to solve them?