Jump to content


Varscott11's Content

There have been 23 items by Varscott11 (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#261331 Test for a sub directory

Posted by Varscott11 on 02 November 2016 - 07:31 PM in Ask a Pro

I've tried out this method and it works great. Thanks for the support!



#261287 Test for a sub directory

Posted by Varscott11 on 01 November 2016 - 09:16 PM in Ask a Pro

I'm sure there is a way, but I can't find it. I need my program to test to see if there is at least one sub directory folder in another folder. The name or whatever doesn't matter

("UO_Users/") --Test for any subdir in this folder.

I've tried fs.list, but the table it produces never seems to work like it should

Any help appreciated :)



#258618 Load a files code and run it in a different program

Posted by Varscott11 on 29 August 2016 - 03:24 PM in Ask a Pro

I have taken into account the api system and have even employed it once in the code. However I still was not able to call functions properly and it came up with an error that said the function I was asking for was a nil. I've looked over both scripts and they are both pretty close to devoid of bugs, as I debug as I go. I really don't know what I'm doing wrong. It might be a bug in my code, which I could sort out, but I need to make sure that what I do, can atleast call functions from the other script.

P.S Thanks for the help so far. :)



#258570 Load a files code and run it in a different program

Posted by Varscott11 on 28 August 2016 - 03:49 PM in Ask a Pro

I have tried loadfile, and the other script runs like it should. Sort of. The two scripts however don't communicate with each other, and I cannot call functions that are stored in the other file correctly. Any ideas?



#258534 Load a files code and run it in a different program

Posted by Varscott11 on 28 August 2016 - 02:09 AM in Ask a Pro

If I do loadfile, will that allow for one file to call functions of the other?



#258532 Load a files code and run it in a different program

Posted by Varscott11 on 28 August 2016 - 01:56 AM in Ask a Pro

I took a look at the PIL, and had some trouble with it. But what I have gathered is that I might need to use loadfile to get the code over to file1? correct me if i'm wrong



#258527 Load a files code and run it in a different program

Posted by Varscott11 on 28 August 2016 - 01:02 AM in Ask a Pro

This has stumped me for a long time now. I have two files:

file1:"unet"
file2:"unetclientdata/libraries/rnetconfigx12"

I need the unet program to load the entire file, rnetconfigx12, and run it as if the code for file2 was part of file1.

Sorry if this is too much, but I also need them to be compatible with each other. As in file 2 can call functions from file 1 and vise versa.

Any help is appreciated!



#258510 test if modem is activated?

Posted by Varscott11 on 27 August 2016 - 05:47 PM in Ask a Pro

Thank you! That is exactly what I wanted! :)



#258504 test if modem is activated?

Posted by Varscott11 on 27 August 2016 - 04:51 PM in Ask a Pro

Is there a way to determine if a modem attached to a computer is on or off, and turn that info into a boolean for later use?



#255489 for loop is only able to run once?

Posted by Varscott11 on 04 July 2016 - 06:30 PM in Ask a Pro

Yeah. That usually happens. I post and then find the problem

Thanks for trying to help me. Appreciate it :)



#255487 for loop is only able to run once?

Posted by Varscott11 on 04 July 2016 - 06:24 PM in Ask a Pro

hold on a sec. I think i found something

WOW! I've got to stop posting on the forums to early. I needed to put this:

local list = { [2] = "value1", [6] = "value2"}
local foundvalue = false
local uservalue = io.read()

foundvalue = false
for key,value in pairs(list) do
if value == uservalue then
foundvalue = true
else
--nothing is supposed to go here
end
end

if foundvalue == false then
--blah,blah,blah

it needed to set foundvalue back to false so that if it could run again. Sorry for the trouble.

Also by using [code] tags, does that put it into code form?



#255479 for loop is only able to run once?

Posted by Varscott11 on 04 July 2016 - 05:20 PM in Ask a Pro

I have a for loop designed to test if the user's input, matches an entry in a table. The for loop I used is shown here:

local list = { [2] = "value1", [6] = "value2"}
local foundvalue = false
local uservalue = io.read()

for key,value in pairs(list) do
if value == uservalue then
foundvalue = true
else
--nothing is supposed to go here
end
end

if foundvalue == false then--executes code at the end of the for loop if it has not found the value
--blah,blah,blah

the for loop works great, but only once. The next time I try to activate it from a function, it doesn't seem to want to run.

Any ideas?



#255438 test if for loop has ended

Posted by Varscott11 on 03 July 2016 - 11:18 PM in Ask a Pro

I ended up figuring out what I needed to do. I just needed to put the code I wanted to execute after the for loop's "end". Making that code execute, once the for loop is complete. I should have figured this out on my own. I guess it is late, and my brain is shutting down.



#255431 test if for loop has ended

Posted by Varscott11 on 03 July 2016 - 10:14 PM in Ask a Pro

Basically, I want a line of code to be executed once a for loop has finally ended. My for loop is designed to search a table and satisfy an if statement:

local list={ [1] = "string1", [2] = "string2"}
local string
for key,value in pairs(list) do
if string == value then
--blah,blah,blah
end
end

--part that is supposed to execute code once the for loop is completed



#255426 get the location of a value in a table

Posted by Varscott11 on 03 July 2016 - 09:18 PM in Ask a Pro

I've been working with tables, and have created a for loop what looks like this:

for key,value in pairs do

blah, blah, blah.

Is there a way to find the key value that equals the actual value?

kind of like this but in reverse:

local list={ [1] = "hello"}

local value=list[1]



#255413 send a script through rednet to be executed on the other side

Posted by Varscott11 on 03 July 2016 - 07:44 PM in Ask a Pro

Very nice. Thank you for your support. I was clueless before!



#255408 send a script through rednet to be executed on the other side

Posted by Varscott11 on 03 July 2016 - 06:54 PM in Ask a Pro

Is there a way to execute that string like its own program?



#255404 send a script through rednet to be executed on the other side

Posted by Varscott11 on 03 July 2016 - 05:11 PM in Ask a Pro

I have a system that needs to send a whole script file through rednet, that gets executed on the other computer. If this is even possible, does anyone know a way to do it? I've searched everywhere with no avail. Any help is appreciated!



#254872 string.sub question

Posted by Varscott11 on 26 June 2016 - 04:09 PM in Ask a Pro

Thanks for the reply! trying it now

Why thank you good sir. It works!



#254870 string.sub question

Posted by Varscott11 on 26 June 2016 - 03:58 PM in Ask a Pro

So I have a program that needs to take a string received through rednet, and determine what the last few letters are.
I have set up a string.sub to handle this that looks like this:

id, message = rednet.receive()
messagesub = string.sub(message, pos1, pos2)

I've tried:

local messagelength = #message - 4 --subtract for from the total length
message = string.sub(message, messagelength)

However, its keeps giving me an error, "attempt to get length of nil"

what I was wondering is if there is a way to get the last 4 letters of the string. Any help is appreciated!



#254815 Create a lua interpreter

Posted by Varscott11 on 26 June 2016 - 01:34 AM in Ask a Pro

Thanks for the reply Exerro! This helped alot. I have begun making some basic commands for the user to use while keeping in mind the parsing method.



#254719 Create a lua interpreter

Posted by Varscott11 on 24 June 2016 - 04:22 PM in Ask a Pro

I want to do exactly what Exerro said. Use it to convert mainly simplified gui code into lua form.
Any help is appreciated :)



#254528 Create a lua interpreter

Posted by Varscott11 on 22 June 2016 - 06:17 PM in Ask a Pro

I'm currently working on a program called UNET, which is a very complex internet service. When it comes to the servers, I want to make it so that the web designer, can create his/her website using a lua interpreter. This will ease the pain of using lua to create things like the gui, by simply converting the users simplified code to it's lua equivalent. Problem is, I have no idea how to go about doing this. Anyone have any ideas? :)