Talk:Lua

From GMod Wiki

Jump to: navigation, search

Contents

How many contribute?

I'm just curious how often people contribute to this Wiki. I have been trying to fill in the blanks the best that i can. But i still see allot of functions that i have no clue how to use but i see people using it in their code. Please help out and turn the red links into blue :) MadDog986 14:10, 9 June 2008 (GMT-6)

People are assholes. I add something and tag it, and people remove it. If they want to remove my tags, then i am no longer contributing to this wiki. You know who you are, so fuck off MadDog986 00:56, 26 June 2008 (GMT-6)

You aren't meant to tag the public face of the wiki. If we want to thank someone for marvelous edits, we can just look at the history. I believe I speak for everyone when I say: thank you for contributing, but please take your need for worship and your violence elsewhere. We are happy to let you remain your happier intelligent side here. Deco Da Man 14:18, 17 December 2008 (GMT-6)

If only GMod wiki could be as well organized as Wikipedia... however, to get there we can't be adding tags and author names and stuff like that to pages--Infinitywraith 08:56, 19 February 2009 (GMT-6)

When you edit a page, you are accredited the edit on the history page. Adding a tag when you've made a great edit on the page itself makes the page ugly and filled with redundancy. My suggestion is keep it to the discussion page. I would love to improve this Wiki when it comes to organization and the distribution of information. --Unrealomega 22:27, 26 February 2009 (GMT-6)

Things

I think that the shared functions should have their own page, rather than being listed in both the clientside and serverside pages. That way, when we add in the prototypes, we won't have to duplicate our work. I don't understand FunctionDump.lua well enough to modify it to do this, but if someone could, that would be cool.

I've also noticed that there are a number of "free functions" that exist at the global level, which are currently undocumented. I wrote a script to enumerate those, and I should add those in. Maybe we should get rid of "common functions" and have a section, "Shared Functions?"

-- Enumerate "free functions"
for k, v in pairs(_G) do
	if type(v) == "function" then
		print(k)
	end
end

MisterPhyrePhox 02:31, 3 December 2006 (GMT Standard Time)


I'd say just append it as an additional category to the one's we already have. Go ahead and delete the "shared" functions in the other categories and place them in the new one. bucketofmayo 12:58PM, 25 June 2007 (GMT Central Time)

Icons

Who took away the superb icons by Yarin? And why? --Skurmedel 03:23, 4 December 2006 (GMT Standard Time)

Looks like his icons are on his profile page MadDog986 03:45, 15 June 2008 (GMT-6)

Organization

I don't like the organization of the Lua categories. I think it would make more sense to have a bunch of lists of all the Lua functions seperated different ways, than grouping them all into just a few categories, alphabetically; it will be more helpful for referencing, because people don't always look for things based on general function. Function is a good way of defining the operations, but we should sort them different ways to make the articles more useful. --Pyroguy 19:45, 4 December 2006 (GMT Standard Time)

More accurate descriptions

I don't like the format of the descriptions of functions as simple sentences. I suggest we add the name of the variable, in parenthases, that a word in a description references; for example, suppose there is a function -> G.Blah(String duh, Number times); the description would be something like "Writes a word (duh) to the console a number of times (times)." --Pyroguy 19:40, 5 December 2006 (GMT Standard Time)

C-style syntax

I don't think we should be saying to people "You can use this" without at least mentioning that it's going to cause issues. Even if it's not recommended to use Lua's own, people should be dissuaded from using C-style syntax.--Morpheous 22:51, 7 December 2006 (GMT Standard Time)

No they shouldn't, they should be encouraged to use it because Lua's syntax sucks. That's why I added C++ syntax. garry 22:55, 7 December 2006 (GMT Standard Time)
What about syntax highlighters, syntax checkers etc all engineered for Lua? They don't like having C++ syntax shoved into their code, all this does is break the Lua spec. --Morpheous 23:00, 7 December 2006 (GMT Standard Time)
It is easy to edit the syntax highlighters to add /* */ and //. I think all this C++ stuff is okay as long as people are told it's a GMod only thing. Anders 23:03, 7 December 2006 (GMT Standard Time)
Yeah, but i'm thinking interoperability. If someone takes a GMod script from one source who used C-style comments their editor might not be set up for that, you'll get errors, broken highlighting and end up needing two presets in your editor worst case. Lua-standard, it's a standard, where is the issue? Recommend the standard to the users; advanced users know the issues regarding C-style commenting. But most coders would never need it and prefer Lua-style nonetheless.--Morpheous 23:05, 7 December 2006 (GMT Standard Time)
It's just better if they learn the right way from the start. Standard Lua isn't the right way to code Lua in GMod10. C++ is. The only problem is syntax highlighting, and this isn't a problem at all, it's just colours in an editor. garry 23:20, 7 December 2006 (GMT Standard Time)
I respect your decision; but do you think it's the right one? Your main community's response has been against it right from the off, with only a small percentage of users actually benefiting. --Morpheous 23:48, 7 December 2006 (GMT Standard Time)
Yeah it's the right one. You're the only one bitching about it. garry 23:53, 7 December 2006 (GMT Standard Time)
Only one voicing my opinion, more like. I'm more concerned that you seem to want to force this upon users who can make their own minds up. --Morpheous 23:55, 7 December 2006 (GMT Standard Time)
Users who can make their own minds up can make their own minds up. I'd rather new people came in learning the new syntax than learning 2 versions of it. The fact is that Lua's syntax is stupid, a lot of it is the way it is just to be different, and adds no more readability or usefriendlyness. I'd rather new guys with no idea how to code come and learn c++ syntax and take away some useful coding knowledge than stuff that is going to confuse them when they move onto other languages. garry 23:58, 7 December 2006 (GMT Standard Time)
By your same argument, if you call it Lua then use Lua syntax as your primary syntax so people don't get confused when they move onto other languages or other Lua implementations. Anyway, why bother telling people about it on this page? If they want to use it they can use it.

From #luahelp:

(+anders) the || && etc is just garry's lazyness
(+anders) you'll just get confused later

I'm not the only one pissed off. --Morpheous 00:04, 8 December 2006 (GMT Standard Time)

I really don't think it has anything to do with Laziness, it has to do with typing `and' and 'or' looking stupid and untidy. If people want to learn the real Lua syntax then they're welcome to go to Lua and download it. GMod isn't Lua, it's a customised implementation of Lua. This is all we need to tell people - and recommend that they use the C syntax, because that's what we use in GMod. garry 09:58, 8 December 2006 (GMT Standard Time)
It's not stupid or untidy- it's actually far easier to read, more human and neater, in my opinion. Of course, if you feel otherwise, that's your opinion. I'm saying that's fine; but i'm saying we should be sticking to Lua's base as a standard as much as possible to avoid technical complications, and allow people to use C-syntax where they prefer to do so- for example, you prefer it, so there's no issue with you using it. My main aim here is wiki neutrality and allowing people to make their own minds up instead of being told what they've been doing for nearly a year is wrong and should be done your way because you prefer it.--Morpheous 10:31, 8 December 2006 (GMT Standard Time)
But we're not coding in Lua. That's your whole argument. It's a customised non-standard implementation of Lua - and I recommend people use the new syntax - because I can't guarentee that the old one is going to be supported. garry 11:18, 8 December 2006 (GMT Standard Time)
I'm with Garry on this one, I think the Lua syntax is terrible, not just the comments, and the C-style stuff is a lot easier to read. --Skurmedel 14:15, 8 December 2006 (GMT Standard Time)

I don't understand why we don't just call it something else besides Lua, if it really is that different. --Ortzinator 03:37, 19 December 2006 (GMT Standard Time)

C-Style syntax is much more natural to veteran developers than lua syntax, Alot more people have coded in C/C++/c# than Lua. I think it was a great desicion as it cleans up program flow Terence 08:02, 4 May 2007 (GMT-5)
I Agree completely (with Terence). Developers (like me) who have just started to use Gmod's Lua that have worked with another programming language will most likely have been working with something like a C-Style syntax. It makes it easier for us, and any new users who may want to one day move to a different language and away from GMod. Redx475 13:45, 1 September 2009 (UTC)

Description of Lua

I've noticed people keep adding things to the description of Lua on the page. There are a few misconceptions that keep circulating, such as

Lua actually comes with a host of general functions, a mathematics library, and a seperate interpreter program. You can write programs in Lua, just like you can in PHP, Python, Perl or Ruby.

Lua code gets compiled to an internal format when scripts are loaded. The difference is that the script is then executed from this format, not written to a file so it can be executed later.

What is a coding language? The terms you are looking for are interpreted language and compiled language.

Lua isn't an API. An API is an interface that a computer program uses to interact with another computer program. Lua, in this case, uses the Garry's Mod API to interact with the source engine.

Please, if you're not completely sure what you're adding is actually correct, just leave the description as it is. Merlzoth 10:51, 8 December 2006 (GMT Standard Time)

Agreed- the last version looked like it was written by someone with no clue about what Lua was. It's fine now, so it should remain untouched from now. Pity we can't lock sections, only whole pages.... --Morpheous 10:33, 8 December 2006 (GMT Standard Time)


The Real Issue

What if instead of whinning about the layout now, we work on filling out the rest of this wiki huh?

Call me crazy but you cannot deny that this wiki is around 65% done and thats solid reality.

is 98% undefined (that 2% is the one function out of 25 that is defined)

Zanbastic II 05:07, 2 June 2007 (GMT-5)


We need to recruit more "archivers". bucketofmayo 1:02PM, 25 June 2007 (GMT Central Time)

"Whats New" section?

I would love to see a "Whats New" section. Sometimes with new releases, new things are added. It would be nice to know what they where so i didn't have to relie on reading every single topic in the LUA forums. Is there any way to find what new functions are added to lua in each update? MadDog986 08:26, 26 January 2009 (GMT-6)

Added an introduction to Lua section

If having to scroll to see links is annoying, then I do apologise to your poor fat fingers... But I'm sorry, their size must be sacrificed for the effort of getting rid of Lua programmers who don't even know the language properly. Add stuff if you think of anything, but please consult with me before you edit my section. Deco Da Man 19:52, 7 April 2009 (GMT-6)

Where to start

@ Kohan

We don't need to add more screen clutter the the top of this page. This section is already being covered by "For newcomers to the Lua language". If anything what should be done is adding explations under each headers such as "Learning and Tutorials" and "Official Lua Documentation and Tutorial" but PLEASE no more blue blob at the top. Also there is no such thing as "knowing lua" or "not knowing it". It is not definitive and the only thing it makes me think of is newbies screaming "You don't know lua gtfo lol" at one another. I do agree that information is not easy enough to find right now and I'm working on it. I plan to merge all lua language tutorials into one big "Lua Starter Tutorial" and then merge articles and Lua Tutorial series into one explicit section detailed in many categories such as gamemodes, weapons, entitiyes, NPCs.. you get the idea. If you feel you really MUST do changes to the page right now either improve the 2 current heading paragraphs or create new regular ones under category headers. Also if you see someone reverting your edit and don't want him to revert them again please use the talk first, please. I'm not trying to be your enemy and I don't want to get into any kind of edit war.

--Crazy Quebecer 20:37, 10 November 2009 (UTC)

Can we use python or perl in GMOD instead of LUA?

Both languages are highly embeddable and much easier to read than lua. Im for python because it forces you to make your code look decent, some gmod lua coders make thier code look terrible, and like garry said , dont trust the modder. What looks nicer to you?:

 
-- Lua
if condition then dothis end
 
 
# Perl
if (condition) {dothis}
 
 
# Python
if condition:
    dothis
 

LUA's syntax is ugly and confusing, also people should be discouraged from using abbreviations in thier code.

Once you get over the "this is weird" feeling about python its natural

I think garry should implement python or perl along with lua and maybe create a seperate section of gmod.org for python code or perl code

Im new to editing wikis so please have mercy XD

The page and related pages are poorly constructed.

The purpose of this page is very vague to me, it is placed on the main page yet some of the links

  1. related to lua are placed on the Main_Page but not here.
  2. The sub categories under the lua title in the main page are all things that should appear under learning and tutorials (One of them IS the link to the Lua_Tutorial_Series), and there is no link to those tutorials here at all. I suggest they will be moved here.
  3. Change all of the lua related links in the main page to one link under the Gmod manual title under the name lua, or change the sub categories to links of either the categories here or the most important articles or pages related to lua.
  4. Add a short introduction to this page, maybe turn the two bullet points under What is lua? to an actual paragraph instead.
  5. Split Learning and tutorials or just add a new category like Getting started or something else since Getting_Started_With_Lua already has a page.

I'm only going to add Lua_Tutorial_Series to this page since some of this will change the main page and i see that changing it is not something i should do without some kind of approval. also i can't edit the main page derp. --Doc 03:33, 18 May 2011 (IST)

'Function Reference' section is empty

This section of the article is content-less and I ask to delete this Level 2 headline until content has been added. --longbyte1 11:06, 3 June 2011 (PDT)

Meh, I deleted it anyways. Say here if you need the section back.--longbyte1 17:14, 4 June 2011 (PDT)

Serverside/Clientside Functions?

On Lua We have hooks reference but where is functions reference? This _really_ should be listed here. Can anyone take care of it? I don't want mess anything up so I won't do it myself. Thanks in advance! 76561197998638899 04:53, 27 August 2011 (PDT)

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox