jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 10:01 PM |
| Is it possible to alter things within loadstring after it has been called? For example say I made a ban script inside of a loadstring, but then I wanted to unban the player, is it possible? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 09 Feb 2014 11:49 PM |
Yes its possible, but you'll have to call loadstring again. Think of it like this. The string is a word document. You print out the word document and turn it in to your teacher. Now, you can go home and change the word document right? But what you turned in to your teacher remains the same. Same concept here. Besides how would you alter the string? ._. |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 11:50 PM |
| I mean, I know I can add more to the loadstring, but will that effect what is already in place? I realize I could just use a table to ban people, but say I used their Name or userId, no way to clear it is there? |
|
|
| Report Abuse |
|
|
|
| 09 Feb 2014 11:52 PM |
| loadstring adds to the current script, the answer is yes. |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 11:52 PM |
But I could do something like this and it would work right?
loadstring(
local banned = {"jakej78b"} Game.Players.PlayerAdded:connect(function(p) for _,v in pairs(banned) do if p.Name == v then p:Kick() end end end) )()
loadstring(
table.remove(banned,1) )() |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 11:53 PM |
Okay, you said I could do it, so how would I use another loadstring to undo the action of this loadstring:
loadstring( Game.Players.PlayerAdded:connect(function(p) if p.Name == "jakej78b" then p:Kick() end end) )() |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 09 Feb 2014 11:54 PM |
| Ya stuff like that would work. I thought you meant like edit the text of code that already executed. |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 11:57 PM |
Yeah I do mean text of code that already executed, lol. Just kinda new to loadstring and want to see what all works. Also, loadstring will pick up right where it left off right? SO I could do something like this:
loadstring(a="Hi broth")() loadstring(ers and sisters" print(a) -- -> Hi Brothers and sisters )() |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 09 Feb 2014 11:59 PM |
| Also, sorry for so many question but so new so many question... Does loadstring last forever once you write to it? Or once you remove the script that contains it does it go away? |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 10 Feb 2014 12:02 AM |
| Nevermind on all of it, I just learned how to read and now I see the loadstring is simply the same thing as typing in script, just an alternative method that is used when no other way is possible. |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2014 12:07 AM |
| Where did you learn loadstring? I think its about time I learn it too. |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 10 Feb 2014 12:20 AM |
| Well I originally learned because it is used in script builders and I wanted to make my own scripting command to go along with p299's admin (before kohl's existed) but today I have just came up with it's exactly the same as normal scripting, you just use it in scenarios that it would be impossible to use anything else. |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2014 12:21 AM |
| ok, so where did you start learning..Like what sources? |
|
|
| Report Abuse |
|
|
jakej78b
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 813 |
|
|
| 10 Feb 2014 12:24 AM |
| Lol sorry, it was hard for me to get this through my head too. Using loadstring is the exact same thing as typing script into your studio. It picks up where you left off. I never really learned it before now, I just thought it was something special and powerful function that would be fun to use. |
|
|
| Report Abuse |
|
|
| |
|