language.Add

From GMod Wiki

Jump to: navigation, search
Function
Syntax language.Add( String placeholder, String fulltext )
Where is this used?
Description:
Adds a language item. Language placeholders are replaced with fulltext in Garry's Mod once registered with this function.
Returns: nil
Part of Library: language
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Language.Add]Language.Add [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionSmall excerpt from a STOOL named cooltool. It has been registered as cooltool.
Used onNewerShared.png
Code
 
if CLIENT then
	language.Add ("Tool_cooltool_name", "The really cool tool")
	language.Add ("Tool_cooltool_desc", "Do some random cool stuff.")
	language.Add ("Tool_cooltool_0", "Left-click: Cool Stuff. Right-click: Nothing.")
	language.Add ("Undone_cooltool", "Cool stuff has been undone.")
end
 
OutputWhen the player presses undo, "Cool stuff has been undone" will be shown. The cooltool's name will be "The really cool tool". Below that, where the description is shown, "Do some random cool stuff." will be shown. Below that, where the instructions or additional notes for the tool are shown, it will display "Left-click: Cool Stuff. Right-click: Nothing.".


DescriptionGives the trigger_hurt a "killicon" name.
Used onNewerClient.png
Code
 
language.Add("trigger_hurt","Hot Lava")
 
OutputWhen the player dies from trigger_hurt, it will be called "Hot Lava" instead of "trigger_hurt" at top right corner.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox