| Lua mod for 1.2.0.2 | |
|
|
|
Author | Message |
---|
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Lua mod for 1.2.0.2 Mon Nov 25, 2013 12:01 pm | |
| hey guys, I've made a port of Sveark's Lua mod to 1.2.0.2, and it runs fine without bugs with most features transferred.
here's there link to the page and here's the URL to the Github repository browser
changes so far: - now using LuaJIT 2.0.2 instead of normal crappy old Lua - has a native module "framework", and comes pre-packed with 2 modules: GeoIP and LuaFileSystem
Last edited by gear4 on Tue Nov 26, 2013 11:05 am; edited 1 time in total | |
|
| |
|HP| Admin
Messages : 226 Joined/Date d'inscription : 2010-06-01
Gema stats farthest jump: MAX
| Subject: Re: Lua mod for 1.2.0.2 Tue Nov 26, 2013 9:25 am | |
| Thx a lot hope it works:D | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Tue Nov 26, 2013 11:05 am | |
| no problem, I've tested it out and most features are working. here's an example script I made a long time ago: https://github.com/gear4s/aclua-1.2/tree/example | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Tue Nov 26, 2013 3:04 pm | |
| lol: - Quote :
- mute_words = {
"******", "nigga", "negro", "kike", "faggot", "motherfucker", "jude", "wichser", "kanake", "polake", "kinderficker", "scheiss auslaender", "bitch", "fuck", "asshole", "poes", "dick", "cock", } why daheck is it worth to mention german bad words, but not brasillian/portugese/french like filha de puta | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Tue Nov 26, 2013 3:39 pm | |
| I only have German friends | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Tue Nov 26, 2013 4:25 pm | |
| Not a point to be sad about, im german Besides that multilingual badwords should be well known to any experienced user/player/serv-owner/dev xD | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Wed Nov 27, 2013 5:48 am | |
| hehe true, I just put them in for defaults | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Wed Nov 27, 2013 1:16 pm | |
| - gear4 wrote:
- (...) most features are working. (...)
So there are some not working? And what's the difference between LuaJIT and old-fashioned Lua? Is it worth to go back to this typeless language or would it make more sense instead to develop a C/C++ API? | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Wed Nov 27, 2013 5:11 pm | |
| I removed some because either I was too lazy to add them or their calls would be impossible to implement in 1202
LuaJIT has the foreign function interface which "allows calling external C functions and using C data structures from pure Lua code"
C/C++ isn't easy to learn if you don't know where to go/what to buy, Lua is just http://lua.org/ | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Thu Nov 28, 2013 8:06 am | |
| http://lua.gts-stolberg.de/index.php lol | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Thu Nov 28, 2013 11:36 am | |
| - gear4 wrote:
- I removed some because either I was too lazy to add them or their calls would be impossible to implement in 1202
So what functions did you remove? - gear4 wrote:
- LuaJIT has the foreign function interface which "allows calling external C functions and using C data structures from pure Lua code"
So you just have to create a C/C++ library with the server logic and call that library from Lua/write a wrapper script. - gear4 wrote:
- C/C++ isn't easy to learn if you don't know where to go/what to buy, Lua is just http://lua.org/
I don't care that C/C++ is hard to learn. I have a book next to me about C and I think it's a pretty good one though it's from 2001 and doesn't have ANSI C-11 in it, but I think it's still good Edit: I looked at the source. You know Doxygen, right? | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Fri Nov 29, 2013 1:04 am | |
| - UKnowMe? wrote:
- So what functions did you remove?
for the laziness: I removed that whole multiple-masters thing. there was also one or two on* handlers that couldn't be added because 1202 removed their "case" in server.cpp but I can't remember which ones, I'll check later - UKnowMe? wrote:
- So you just have to create a C/C++ library with the server logic and call that library from Lua/write a wrapper script.
yep, but why do that when you can make a C/C++ "script" inside the Lua script? - UKnowMe? wrote:
- I don't care that C/C++ is hard to learn. I have a book next to me about C and I think it's a pretty good one though it's from 2001 and doesn't have ANSI C-11 in it, but I think it's still good
you might, but then you're selfish; you're not thinking about other people who can't (due to funds or similar) or otherwise don't have the time to learn C/C++ - UKnowMe? wrote:
- Edit: I looked at the source. You know Doxygen, right?
you know sveark commented most of that, right? | |
|
| |
Sveark
Messages : 124 Joined/Date d'inscription : 2011-05-02 Age : 30 Location/Localisation : Russia
| Subject: Re: Lua mod for 1.2.0.2 Fri Nov 29, 2013 1:09 am | |
| commenting code? what's that? | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Fri Nov 29, 2013 1:11 am | |
| ^_^ I should convert it to that Crappygen anyway | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 6:22 am | |
| - gear4 wrote:
- UKnowMe? wrote:
- I don't care that C/C++ is hard to learn. I have a book next to me about C and I think it's a pretty good one though it's from 2001 and doesn't have ANSI C-11 in it, but I think it's still good
you might, but then you're selfish; you're not thinking about other people who can't (due to funds or similar) or otherwise don't have the time to learn C/C++ Might be, but it's hard to create a 100% secure server (I would guess almost impossible) but it's very easy to create an unsecure one. For example, take a look at this page. A good hacker can easily destroy the whole database if he wants (no one would care, though). So let's take a deeper look: If you store all your passwords in a SQL database and don't encrypt them by using hashes and salts, it would be easy to compromise the database. Let's say you save all your uses in a table with the fields 'username' and 'password'. And check the passwords with a query like "SELECT * FROM `users` WHERE `username` = ? OR `password` = ? LIMIT 1" Now there are two ways to hack into an users account:
- He uses a username like "some_name` OR 1=1-- .". But because such a name is not possible in AC afaik we can ignore that.
- He uses a password like "pwd` OR 1=1-- .". Now the hacker would have access to that account and could blacklist everyone for example.
But SQL Injection is not the only risk, but it doesn't matter because Lua has a garbage collector. But in C/C++ where no garbage collector exists you could theoretically kill the server by flooding it with connections (DoS) and because the programmer didn't freed the objects the server would somewhen kill itself because it hasn't enough memory. | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 7:01 am | |
| meistertt still uses that link, and its still alive/ not yet deleted`? hahaa xD | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 8:17 am | |
| I really don't care what you do, but if you do something that's not on me; I'm just the guy that implements the shit and gets it done. if you write insecure scripts, who cares? if you don't know how to LuaSQL, who cares? stop being a noob and deal with it | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 8:47 am | |
| - gear4 wrote:
- I really don't care what you do, but if you do something that's not on me; I'm just the guy that implements the shit and gets it done. if you write insecure scripts, who cares? if you don't know how to LuaSQL, who cares? stop being a noob and deal with it
A thing to clarify: You can write scripts good as hell, but what does it help if the implementation is shit? About being a noob: Well, you're the one who copied Svearks work and just added a few lines to server.cpp and log.cpp. Oh, and you added of course support to LuaJIT, which was that hard. /ironic And do I have to mention that post some time ago where you were trying to sell scripts? | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 2:02 pm | |
| - UKnowMe? wrote:
- A thing to clarify: You can write scripts good as hell, but what does it help if the implementation is shit?
blame sveark, I'm just a "middle-man" - UKnowMe? wrote:
- you're the one who copied Svearks work and just added a few lines to server.cpp and log.cpp.
line #1: https://gema.forumactif.com/t188-lua-mod-for-1202#p1556 - UKnowMe? wrote:
- And do I have to mention that post some time ago where you were trying to sell scripts?
https://gema.forumactif.com/t133-script-requesting#p1091also, I'd say my scripts are way more shorter and functional than most of you "scripters" | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 2:29 pm | |
| I think you're mixing things up here. First of all you could have written your own implementation and not use Sveark's. Copying other people's work is not what I call programming. Second: Your scripts may be "way more shorter and functional" than ours. Yes, I can also remove every unnecessary whitespace. But maybe I want to edit that code later on, and then it's hard to read (Park you know what I mean). And I don't care if mine script is longer than yours, what counts for me is performance and security. Why do I need a short script if a hacker can use it to take over the server? And why shouldn't I write more lines of code but get a better performance? And please don't call other people "scripters" if you don't know them. For example I am a software developer for Java in a German company called Speed4Trade. | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: in addition to uknowme Sat Nov 30, 2013 2:32 pm | |
| your evading questions.
1) if svearks implemention is ok ( good in the most points, but flagaction ,.. eh.. , .. etc.) (im not better.. )
> youd need to do better to be not called "implementing shit", eg. by leaving stuff out, as lazyness attacks the mellow man
2) "porting" is copying and changing until it works (adapting).
3) you were going to sell scripts, as the post tells. > that you fell back when everyone reacted in pure hate, was definitely noticable.
PS: if i should take that last sentence as an example of your >short and functional< perfection serious, well i dont want to see any script of yours when you fail at a simple sentence of english.
PPS: yeah i know what you mean UKM xD PPPS: no matter how nice the script looks, to increase the performance go compile it.. | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sat Nov 30, 2013 3:36 pm | |
| - UKnowMe? wrote:
- First of all you could have written your own implementation and not use Sveark's
I could have, but I'm too lazy to do that again - UKnowMe? wrote:
- Copying other people's work is not what I call programming
I never said I programmed it - UKnowMe? wrote:
- Your scripts may be "way more shorter and functional" than ours. Yes, I can also remove every unnecessary whitespace. But maybe I want to edit that code later on, and then it's hard to read (Park you know what I mean)
I don't just remove "unnecessary whitespace", I actually make the script shorter. harder to read? pff - UKnowMe? wrote:
- And I don't care if mine script is longer than yours, what counts for me is performance and security. Why do I need a short script if a hacker can use it to take over the server?
you misunderstand what a short script is and could be: more secure, faster, easier to read and quicker to edit - UKnowMe? wrote:
- And why shouldn't I write more lines of code but get a better performance?
I never said that more lines are less performance, I just meant I prefer shorter scripts because I can make it give me better performance in a shorter amount of time - UKnowMe? wrote:
- And please don't call other people "scripters" if you don't know them. For example I am a software developer for Java in a German company called Speed4Trade.
Java? scripter - Park wrote:
- > youd need to do better to be not called "implementing shit", eg. by leaving stuff out, as lazyness attacks the mellow man
I've implemented a LuaFileSystem type of library and I've implemented source GeoIP, but I ported sveark's mod - Park wrote:
- 2) "porting" is copying and changing until it works (adapting).
I copied and changed what I could in 16 straight hours and I practically gave up after I saw the changes I'd have to make to MS system - Park wrote:
- 3) you were going to sell scripts, as the post tells.
> that you fell back when everyone reacted in pure hate, was definitely noticable. I really was just joking, anyone that really knows me knows that I do it all the time - Park wrote:
- PS: if i should take that last sentence as an example of your >short and functional< perfection
serious, well i dont want to see any script of yours when you fail at a simple sentence of english. I failed ? how ? - Park wrote:
- PPS: yeah i know what you mean UKM xD
PPPS: no matter how nice the script looks, to increase the performance go compile it.. already done, LuaJIT if you don't like my effort then I'll just remove the repo | |
|
| |
Park
Messages : 272 Joined/Date d'inscription : 2011-11-04
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sun Dec 01, 2013 1:48 am | |
| na its fine, i could care less, but leave it, it makes lua and gema persistent to 1.2 which is great. dont mind me, lol, i usually have my fun at argueing. also, the problem of inefficient scripting is lazyness (eg table.insert instead of table[#table+1] = ..) and missing knowledge.. anyhow you seem to have a quite bit of this knowlege, but still, if you dont mind: gear4 = jg + skill | |
|
| |
UKnowMe?
Messages : 51 Joined/Date d'inscription : 2012-10-08 Location/Localisation : Germany
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sun Dec 01, 2013 4:54 am | |
| gear4, now you should really leave. Calling someone a "scripter" because he is using Java is pure nonsense. I think you don't even know Java. Java is a very powerful language if you know how to use it. It might be that it is slower than C/C++ compiled programs, but Java programs are running on every system with the JVM, whilst a C/C++ Windows program won't work on Linux because Linux has other libraries. - gear4 wrote:
- short script is and could be: more secure, faster, easier to read and quicker to edit
I'll give you 2 quick examples. First one: - Code:
-
for i,v in ipairs(sometable) do print(i, v) end -- bad, slow -- better: for i=1,#sometable do print(i, sometable[i]) end You can Google why the last code is better. Another example: - Code:
-
function someFunc() -- adapted from Park's server local math_rand = math.random for i,v in pairs(table) do local x = math_rand(#v) while Used[i][1]:find(x) do x = math_rand(#v) end local delay = os.time() + math_rand(math.max(2,DelayRange[1]),math.min(15,DelayRange[2])) table.insert(Trigs,{delay,reply:gsub("%(user%)",getname(user))}) break end end This is faster than calling math.random every time. You can ready why here. Of course, if I hadn't called the variable math_random but instead something like func_81671_a you couldn't read that code in a nice way. So "shorter and more functional" isn't always a synonym for "secure and fast". And to that masterserver thing: Not every project gets done in 16 hours. You could have taken a break, sleep a bit, and then look at it again. I'm also not working for 16 hours straight and then when a problem comes up I say "fuck it, I don't need this anyways". You might not need it, but others. | |
|
| |
gear4
Messages : 28 Joined/Date d'inscription : 2013-04-03 Age : 27 Location/Localisation : English
Gema stats farthest jump:
| Subject: Re: Lua mod for 1.2.0.2 Sun Dec 01, 2013 9:23 am | |
| - UKnowMe? wrote:
- gear4, now you should really leave. Calling someone a "scripter" because he is using Java is pure nonsense. I think you don't even know Java. Java is a very powerful language if you know how to use it. It might be that it is slower than C/C++ compiled programs, but Java programs are running on every system with the JVM, whilst a C/C++ Windows program won't work on Linux because Linux has other libraries.
- gear4 wrote:
- short script is and could be: more secure, faster, easier to read and quicker to edit
I'll give you 2 quick examples. First one: - Code:
-
for i,v in ipairs(sometable) do print(i, v) end -- bad, slow -- better: for i=1,#sometable do print(i, sometable[i]) end You can Google why the last code is better. Another example: - Code:
-
function someFunc() -- adapted from Park's server local math_rand = math.random for i,v in pairs(table) do local x = math_rand(#v) while Used[i][1]:find(x) do x = math_rand(#v) end local delay = os.time() + math_rand(math.max(2,DelayRange[1]),math.min(15,DelayRange[2])) table.insert(Trigs,{delay,reply:gsub("%(user%)",getname(user))}) break end end This is faster than calling math.random every time. You can ready why here. so imagine someone requires you to call that function 100 times for 100 other function results, in a short period of time. ever tested local variable initialization time? bet you never - UKnowMe? wrote:
- Of course, if I hadn't called the variable math_random but instead something like func_81671_a you couldn't read that code in a nice way. So "shorter and more functional" isn't always a synonym for "secure and fast".
are you blind? or did you just not read my previous post fully? - UKnowMe? wrote:
- Not every project gets done in 16 hours. You could have taken a break, sleep a bit, and then look at it again.
I prefer to do my work quickly so I get done with it quickly so I have more time to play other games like WoW and Skyrim - UKnowMe? wrote:
- I'm also not working for 16 hours straight and then when a problem comes up I say "fuck it, I don't need this anyways". You might not need it, but others.
you're right, I should've done it a long time ago. guess laziness just crept up on me | |
|
| |
Sponsored content
| Subject: Re: Lua mod for 1.2.0.2 | |
| |
|
| |
| Lua mod for 1.2.0.2 | |
|