Top posting users this month | |
Latest topics | » Where to go from here.September 14th 2020, 1:20 pm by MrNicNac» Send me an EmailSeptember 14th 2020, 1:16 pm by MrNicNac» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]July 6th 2015, 7:38 pm by m27frogy» New Site PossiblyJuly 6th 2015, 4:16 pm by m27frogy» Ambassador!April 15th 2015, 11:40 pm by naknak» Boop - TagApril 13th 2015, 9:46 pm by naknak» Vip Class ScriptApril 13th 2015, 4:54 pm by naknak» Who's active?!April 13th 2015, 4:52 pm by naknak» Genesis PointJuly 17th 2014, 7:04 pm by branefreez» Reward SystemJuly 17th 2014, 5:41 am by m27frogy» Script RequestJuly 10th 2014, 11:43 am by naknak» local scripts?July 10th 2014, 11:39 am by naknak» Project: Reconstruction [Died]July 10th 2014, 11:36 am by naknak» Hi. I am new hereApril 26th 2014, 4:01 pm by altshiftkey» What's your favorite sport?January 1st 2014, 2:13 pm by m27frogy» FlashLight ScriptJanuary 1st 2014, 2:11 pm by m27frogy» Gun Making! [READ DESC]January 1st 2014, 2:10 pm by m27frogy» Hi, I am new here!November 26th 2013, 3:33 pm by Keanu73» Improve CodingOctober 26th 2013, 1:12 pm by pook03» Simple ButtonSeptember 1st 2013, 6:19 pm by branefreez |
|
| Roblox is stupid, so I'm posting a script here for anyone to fix. | |
| | Author | Message |
---|
Guest Guest
| Subject: Roblox is stupid, so I'm posting a script here for anyone to fix. March 12th 2011, 12:51 am | |
| You may have been lead here because of my post on Roblox, or you may just be checking this site. I don't care. Here is what's wrong: THE FUNCTION: - Code:
-
local function runScript(msg) if string.sub(msg, 1, 4):lower() == string.lower("run/") then print(msg:sub(5) .. " return 1") local str = loadstring(string.sub(msg, 5) .. " return 1") getfenv(str).print = OutputPrint -- a function I made local stat, err = coroutine.resume(coroutine.create(str)) print(stat, err) repeat wait() until not stat or err == 1 -- I'm still experimenting with this part, but I can't test it until I get the loadstring stuff fixed print(stat, err) if err == 1 then script.Parent.Text = "It worked :D" wait(3) script.Parent.Text = "Output GUI" else script.Parent.Text = tostring(err) end end end
runScript([[run/print("Hello") wait(1) error("wut")]]) THE OUTPUT: Fri Mar 11 23:43:13 2011 - [string "print("Hello") wait(1) error("wut") return ..."]:1: wutFri Mar 11 23:43:13 2011 - [string "print("Hello") wait(1) error("wut") return 1"], line 1 stack end I've been trying to fix my SB, 'cause ever since I switched it from pcall to coroutines, it just didn't work. Obviously, the error is coming from the loadstring stuff, but I don't understand why, since coroutine.resume is supposed to run stuff in protected mode ._. HALP. |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 14th 2011, 5:46 am | |
| I've modified part of it and it might work:
local function runScript(msg) if string.sub(msg, 1, 4):lower() == string.lower("run/") then print(msg:sub(5)) local stat, err = loadstring(string.sub(msg, 5)) print(stat, err) if not err then script.Parent.Text = "It worked :D" wait(3) script.Parent.Text = "Output GUI" else script.Parent.Text = err end end end
runScript([[run/print("Hello") wait(1) error("wut")]])
| |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 14th 2011, 5:48 am | |
| and the error message that was in the output before was because you used the function 'error' to print 'wut' as an error message. | |
| | | Guest Guest
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 16th 2011, 5:30 pm | |
| @Bluey: I'm using coroutines because they should run in protected mode (kinda like pcall). I highly doubt that your "solution" would work :o
But without this, my SB will never be fixed D: |
| | | naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 16th 2011, 9:03 pm | |
| You couldn't just take all the code out of the function, adjust it to still work, and then run it to find out what line(s) was wrong? I would, but I don't have enough time right now.
| |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 17th 2011, 6:42 am | |
| I think your's works actually! noticed how you used the error() function instead of print()? | |
| | | naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 17th 2011, 9:05 pm | |
| | |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 18th 2011, 4:32 pm | |
| I'm just changing 1 function:
local function runScript(msg) if string.sub(msg, 1, 4):lower() == string.lower("run/") then print(msg:sub(5) .. " return 1") local str = loadstring(string.sub(msg, 5) .. " return 1") getfenv(str).print = OutputPrint -- a function I made local stat, err = coroutine.resume(coroutine.create(str)) print(stat, err) repeat wait() until not stat or err == 1 -- I'm still experimenting with this part, but I can't test it until I get the loadstring stuff fixed print(stat, err) if err == 1 then script.Parent.Text = "It worked :D" wait(3) script.Parent.Text = "Output GUI" else script.Parent.Text = tostring(err) end end end
runScript([[run/print("Hello") wait(1) print("wut")]])
| |
| | | naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 19th 2011, 11:26 am | |
| | |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 20th 2011, 1:13 am | |
| '[string "print("Hello") wait(1) error("wut") return ..."]:1: wut' that is the output that is meant to to happen because of this: 'error("wut")' | |
| | | Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 20th 2011, 11:11 pm | |
| hmmm. sigh* do strings in lua have to be that complicated? | |
| | | naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 22nd 2011, 7:31 am | |
| Yes, they do. For some reason, they do. | |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. March 25th 2011, 6:35 am | |
| *rage* THE PROBLEM HAS NOTHING TO DO WITH STRINGS. if you look up the function error() on wiki it'll tell you that it makes error messages in the output. | |
| | | Sponsored content
| Subject: Re: Roblox is stupid, so I'm posting a script here for anyone to fix. | |
| |
| | | | Roblox is stupid, so I'm posting a script here for anyone to fix. | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Who is online? | In total there are 5 users online :: 0 Registered, 0 Hidden and 5 Guests
None
Most users ever online was 136 on October 21st 2024, 12:16 pm
|
| Please tell us what time zone you are in here
Got a really good idea? Post it in projects and it might show up here! |
|