• index global var issue
    2 replies, posted
Hey All, I am probably just stupid and not doing something right but I am super new to coding in LUA. I am attempting to modify an addon to grab the entity name and change the maintext to "Aether Printer" local maintext  local maintextcolor if self:Getbroken() == 1 then maintext = "Needs Repair" maintextcolor = Color(255,0,0,255) elseif ent:GetClass() == "aether_printer" then maintext = "Aether Printer" maintextcolor = Color(255,255,255,255) else maintext = "Ultimate Printer" maintextcolor = Color(255,255,255,255) end Error: [ERROR] addons/ultimate_printers/lua/entities/printers_base/cl_init.lua:55: attempt to index global 'ent' (a nil value)   1. unknown - addons/ultimate_printers/lua/entities/printers_base/cl_init.lua:55 The elseif statement starts line 55 1 - I hope this is in the right order and it is just a syntax error that I don't understand. 2 - I have looked all over the forums and checked previous work from others to help identify the issue but no avail Before Error: http://prntscr.com/jhjo8n Overall I am attempting to change where it says "Ultimate Printer" on the "ultimate_printer" entity or "Aether Printer" on the "aether_printer" entity. Thanks in advance!
You're using "ent" instead of "self" in what I assume is a method function.
Thank you! That was the error and is now fixed!!!
Sorry, you need to Log In to post a reply to this thread.