Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
DeletingRac3rZer0

Does anyone know whats wrong with this?

Recommended Posts

Posted · Original PosterOP

I am trying to learn more about lua, and i want to make a file generator for minecraft that makes a 1000 bossbars with different ids. The use would be for massive multiplayer servers where it could have up to 1k playrs.

 

I have the error about putting parenthasees in placesthat arent nessisary, which this bug is on lua. I want o know how tofix it.

 

-- Variables
-- Files to open - Variables
var openFile0 = "bossbar.mcfunction"

-- Text to write - Variables
var writeL1-1 = "bossbar add bossbarmod:bossbar"
var writeL1-2 = num0

-- Maths - Variables
var num0 = 1
var sum0 = 1
vsr limit0 = 1000

-- Maths
mathsFun()
   repeat
   num0 + sum0
until(num0 = limit0)
end

-- Command Writer
-- Open File
file = io.open(openFile0)

-- Text to write - Code
file.write(writeL1-1)
file.write(writeL1-2)
end

 


B-Baka

Link to post
Share on other sites
3 hours ago, Rac3rZer0 said:

I am trying to learn more about lua, and i want to make a file generator for minecraft that makes a 1000 bossbars with different ids. The use would be for massive multiplayer servers where it could have up to 1k playrs.

 

I have the error about putting parenthasees in placesthat arent nessisary, which this bug is on lua. I want o know how tofix it.

 


-- Variables
-- Files to open - Variables
var openFile0 = "bossbar.mcfunction"

-- Text to write - Variables
var writeL1-1 = "bossbar add bossbarmod:bossbar"
var writeL1-2 = num0

-- Maths - Variables
var num0 = 1
var sum0 = 1
vsr limit0 = 1000

-- Maths
mathsFun()
   repeat
   num0 + sum0
until(num0 = limit0)
end

-- Command Writer
-- Open File
file = io.open(openFile0)

-- Text to write - Code
file.write(writeL1-1)
file.write(writeL1-2)
end

 

It looks like the third Maths Variable has a typo?

vsr limit0 = 1000

should be

var limit0 = 1000

 


Spoiler

CPU: Intel i7 6850K

GPU: nVidia GTX 1080Ti (ZoTaC AMP! Extreme)

Motherboard: Gigabyte X99-UltraGaming

RAM: 16GB (2x 8GB) 3000Mhz EVGA SuperSC DDR4

Case: RaidMax Delta I

PSU: ThermalTake DPS-G 750W 80+ Gold

Monitor: Samsung 32" UJ590 UHD

Keyboard: Corsair K70

Mouse: Corsair Scimitar

Audio: Logitech Z200 (desktop); Roland RH-300 (headphones)

 

Link to post
Share on other sites

I don't believe you can have a hyphen "-" in a variable name as this is an operator. Replace it with an underscore "_", next I don't think 'var' is a thing in Lua: https://www.lua.org/pil/4.2.html Either use 'local' when needed or nothing before a variable name like python. Additionally (unless this isn't the full code) you have an extra 'end' on the last line.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Newegg

×