generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Post your ideas about additions to Lua

Previous Thread :: Next Thread 
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:05 PM
Hey.

I'm currently making modules and/or engravings to/for different programming languages (ie. Lua, python, C++, java) and i'm in need of ideas.

I've currently introduced such functions as:

string.contains()
string.startswith()
string.endswith()
string.matchfl()
string.mess()
string.combine()
+
table.move()
table.clear()
table.contains()
table.limit()
table.tostring()

So i'm wondering if anyone's come up with an idea of an addition for a useful function you wished you had in your use always when coding, but sadly, it's not included in Lua.

All answers will be accepted, as long as they do not appear in the list above nor are built-in Lua 5.1
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:09 PM
Your first 3 string function already exists using string.match
What does 'matchfl' mean?
What does 'mess' mean?
combine already exists, it's called the concatenation operator

table.move exists in 5.3, but can be easily implemented in 5.1
What does table.limit even mean
you can already use the __tostring metamethod to do whatever when tostring is called on your table
Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:14 PM
First 3 functions do not actually exist in Lua.

These accurately check if a string starts with a substring whether that substring is 1 letter, number, lower-case letter or an upper-case letter, or 100 of them mixed in.

Same with .endswith

matchfl checks if a string starts and ends with a certain substring, ie. string.matchfl("Hell","orld!") would match with "Hello, world!", same as "hElLo WoRLd" would.

string.mess turns random alphabets to lower and others upper case.

Tostring can turn several tables into single strings as well as sort them without getting incapacitated by upper-case letters, whilst remaining the string's original form.
Report Abuse
Ultraw is not online. Ultraw
Joined: 20 Nov 2010
Total Posts: 6575
05 Sep 2016 02:16 PM
game.Workspace.Kills.Value += 1
game.Workspace.Kills.Value *= 2
game.Workspace.Kills.Value -= 1

plz


Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Sep 2016 02:17 PM
I think table.limit would be like
x={}
setmetatable(table,x)
x.__newindex=function(s,i,v)
if #x < limit then
rawset(table,i,v)
end
end

But yeah most of these exist already.

string.contains() --> string.find or string.match
string.startswith() ->string:match('^a') --starts with a, can replace that with anything
string.endswith() ->string:match('a$') --ends with a, can replace with anything
plus combine is just concatenation


Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:18 PM
string.match actually returns an int value, not a string.

string.contains returns either true or false, and can be used to check if a string contains one of several keywords.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:18 PM
######################################################################################################################################################################################################################################################################################################################################################################################################
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
05 Sep 2016 02:19 PM
string..string2
:/


I can C-Sharply, can you?
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:19 PM
reread what I said, I said they exist "using string.match"

local function contains(s, p)
return s:match(p)
end
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Sep 2016 02:20 PM
"string.match actually returns an int value, not a string."
You might wanna do some research before you start making claims lol

"string.contains returns either true or false, and can be used to check if a string contains one of several keywords."
You can use match in an if statement because it returns nil if it doesn't match and returns the match if it does. Also you can do that with match.


Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:21 PM
Roblox's forum filter is cancer
pastebin/Z9rfBUiR
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:22 PM
"string.match actually returns an int value, not a string."
You're dumb

"string.contains returns either true or false, and can be used to check if a string contains one of several keywords."
Then double-not the return

local function contains(s, p)
return not not s:match(p)
end
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
05 Sep 2016 02:23 PM
@flux

Wouldn't not not just return the original value? I don't get it


I can C-Sharply, can you?
Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:23 PM
^ Flux-capacitor


Do note that these are not scripts i'm making, these are edits into the root of Lua itself.
I'm not scripting ROBLOX, im re-programming Lua's faults (aswell as python's,java's and C++'s)

And string.match cant seek for multiple substrings within a string.

An additional note; you can use string.match, but i've added string.contains to the syntax of lua, so it can be declared whenever without having to declare a function.
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
05 Sep 2016 02:24 PM
@kofph

1. It can easily be declared like that with Flux's method.
2. Learn about captures, yes it can

@Flux
Oh I just realized, your turning it into a bool, right?


I can C-Sharply, can you?
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:24 PM
"Wouldn't not not just return the original value? I don't get it" No. It returns a boolean. not ### ## false, not false -> true "im ############## Lua's faults" You don't understand what fault means. Lua doesn't have all that crap because it's MEANT TO BE SMALL "And string.match cant seek for multiple substrings within a string." Multiple matches can
Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:25 PM
^ Kodran
Due to all these posts i'm kinda rapidly posting without having much time to think.
I actually meant string.find returns an int value.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Sep 2016 02:27 PM
I included it because you can always do this:
if string:find('x') then

If you want the actual match string then use match.. is that really your argument?


Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:28 PM
^ Flux_Capacitor


For one, if you can't handle an online discussion without declaring idiot you shouldn't participate in the discussion in the first place.

And second, yes, lua is supposed to be a small, easily embeddable language. True.
But it's also an easily configurable language.
Now, i'd rather make the language more comfortable to me if i possibly can; and i can.

For third, this was supposed to be a suggestion topic, rather than to form into a huge argument about petty things.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
05 Sep 2016 02:30 PM
I didn't even call you an idiot, idiot. The "censored" crap is Roblox's horrible forum filtering.

And most of what you say can easily be done with already existing functions, it doesn't make sense to bloat the library in those cases but whatever, your additions not mine.
Report Abuse
imtellingmommy is not online. imtellingmommy
Joined: 10 Mar 2013
Total Posts: 817
05 Sep 2016 02:31 PM
flux likes calling people dumb when he's right
Report Abuse
Kofphtastrophe is not online. Kofphtastrophe
Joined: 28 Oct 2015
Total Posts: 154
05 Sep 2016 02:31 PM
Kodran

You obviously don't know what an argument is.

And for my use, of being able to seek multiple things within a code is an enormous blessing.

It's harder to actually know what you're looking for when you're receiving packets of encrypted data.

I mean, i guess you don't need that because you're programming a tycoon for your friends to play and 'blox' in. Heh.
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
05 Sep 2016 02:32 PM
###################################################################################################
Report Abuse
RemasteredBox is not online. RemasteredBox
Joined: 19 Jun 2016
Total Posts: 2140
05 Sep 2016 02:34 PM
pastebin/aCBjCp3a


I can C-Sharply, can you?
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
05 Sep 2016 02:34 PM
If I were making a garbage tycoon it would still have more value than your useless functions. function ############# for i,v in pairs({...})do local ############## if m then return m end end end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image