• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Global Lua variable with newline

Status
Not open for further replies.
Level 11
Joined
Apr 27, 2009
Messages
202
In Jass set udg_newline = "\n" is for a newline. udg_ is for global in Jass? I need a newline String in Lua that is Global but I don't know how global variable are made in Lua. Could someone help me out?

How could someone edit a Variable made in Trigger with Lua?

This is in Jass
brisi4.png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,511
If you want to reference a GUI variable in Jass/Lua you need the "udg_" prefix, otherwise it's unnecessary.

To create a new Lua variable in GUI you would do this:
  • Custom script: newline = "\n"
Note how Lua doesn't use call or set.

If you want it to be a local variable simply add local before it's name.
  • Custom script: local newline = "\n"

Some other differences between Jass and Lua:
Null becomes Nil, FourCC() must be called when referencing rawcodes, endif becomes end, ' ' becomes " ", and many more.
 
Last edited:
Status
Not open for further replies.
Top