Difference between revisions of "Lua"
(Preparing this article for future lua documentation) |
|||
| Line 36: | Line 36: | ||
{|width="100%" | {|width="100%" | ||
|- | |- | ||
| − | |width="25%" style="border: solid 2px blue; background: # | + | |width="25%" style="border: solid 2px blue; background: #0099FF;"|[[Image:Entity.gif]][[entity_hooks|Entity Hooks]] |
| − | |width="25%" style="border: solid 2px blue; background: # | + | |width="25%" style="border: solid 2px blue; background: #0099FF;"|[[Image:Gamemode.gif]][[game_hooks|Game Hooks]] |
|- | |- | ||
Revision as of 05:09, 28 August 2009
What is Lua?
Lua is a scripting language with a simple syntax. On NS2 99% of the game is made on Lua and it will allow users to make their own modifications. Since it can be easily implemented in any application it is used in other games such as Garry's Mod, World of Warcraft, Far Cry, and more...
Visit the lua official site or the Wikipedia article for more information.
There is not much of Lua documentation for NS2. All we can get for now is from armory lua code, seen here http://www.unknownworlds.com/ns2/news/2007/02/prosumers_and_natural_selection_2.
Note: These functions below are taken from armory lua code and therefor all the descriptions might not explain what the function does in final version. Most of these functions may not be on final version too.
- Entity:SetModel - Sets the model of an entity
- Player:EmitPrivateSound - Plays a sound that only the player hears
- Player:GiveNamedItem - Gives a item to the player. Should work similar to "give" cheat from NS1
- Player:AddResources - Increases or Decreases resources (money) from the player
- Player:GetResources - Retrieves the amount of resources (money) the player has
- Util.Message - Sends a message. (To who?)
- Server.PlayerMenu - Shows a menu to the player
- Engine.PrecacheModel - Precaches a model into memory on startup
- Engine.LinkEntityToClass - Links an entity table to a class
- Event.Hook - Hooks an event to a function
There's also a number of events for entities:
- Entity:OnSpawn() - Called when spawned
- Entity:StartUsing(player) - Called when a player starts using the entity
- Entity:StopUsing(player) - Called when a player stops using the entity
- Entity:OnCommand(activator,command) - When the entity receives a command. Example of these are "buy mg", "buy shotgun"
Lua Documentation:
Entity Hooks
|
Game Hooks
|

