80 posts
Location
Magic land, awesomeness
Posted 29 October 2015 - 02:03 AM
Hello! I would like to know how to load code from a file without an api like os.loadApi() or shell.run() tnx ~GreenGene
80 posts
Location
Magic land, awesomeness
Posted 29 October 2015 - 02:09 AM
I found that loadstring() works, thank you for viewing this topic though ;)/>
2679 posts
Location
You will never find me, muhahahahahaha
Posted 29 October 2015 - 05:21 AM
or dofile("path")
2427 posts
Location
UK
Posted 29 October 2015 - 07:38 AM
dofile is better I think
1023 posts
Posted 29 October 2015 - 11:38 AM
Dofile uses loadstring, so it really is up to preference. Since he said load code from a file out of the two loadstring is definitely the better direct solution.
However, there is a function defined in the bios that will save you a little time, if you only want to load the file as a function but not have it automatically executed like if you were to use dofile. loadfile just loads the file at the given path, and iirc you can pass an environment as the second arg which is used when loadstringing the file.