• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Lua Modulo Weird Behavior

Status
Not open for further replies.
Level 3
Joined
Dec 9, 2014
Messages
18
Hello! I'm writing out some scripts but it seems like when I try to run a modulo I get some weird behavior, for example:

a % b - Causes a syntax error
a % n - Crashes the world editor
a % 1 - Saves fine

Are we not able to use variables with the mod functionality?

Full Example that gives a syntax error:

Lua:
  local function mod(a, b)
    return a % b
  end

Gives following syntax error:
1678004348626.png


I tried to do a little searching and did discover that the % sign can cause crashing but that looks like with string concatenation, is this a similar problem?

Thank You!
 
Status
Not open for further replies.
Top