Attempted to concatenate a nil value? [SOLVED]
I'm making a ROBLOX implementation of CSS (to be used with GUIs) with a ModuleScript, and I'm getting an error. (These scripts are long but you shouldn't need to read the whole thing)
ModuleScript:
03 | local function splitStylesheet(sheet) |
08 | for i = 1 , string.len(sheet) do |
09 | if string.sub(sheet, char, char) ~ = "}" then |
10 | table.insert(split, line, split [ line ] ..string.sub(sheet, char, char)) |
21 | local function findSubstyles(dump) |
22 | print ( "Splitting dump..." ) |
27 | for brackets in string.gmatch(dump, "{" ) do |
31 | for brackets in string.gmatch(dump, "}" ) do |
36 | local substyles = open |
39 | elseif open > close then |
41 | elseif close > open then |
48 | module.readStylesheet = function (name, dump) |
49 | print ( "Reading stylesheet \"" ..name.. "\"" ) |
51 | if not name or not dump then |
52 | error ( "Missing arg (function readStylesheet)" ) |
57 | local substyles = findSubstyles(dump) |
59 | if substyles = = "open" then |
60 | error ( "Assembler detected stray open bracket. Please check stylesheet" ) |
62 | elseif substyles = = "close" then |
63 | error ( "Assembler detected stray close bracket. Please check stylesheet" ) |
65 | elseif substyles = = "fatal" then |
66 | error ( "Assembler encountered fatal error. Please check stylesheet" ) |
69 | print (substyles.. " substyles found" ) |
73 | local styletable = splitStylesheet(dump) |
Script I'm using the Module with (it's in a ScreenGui):
1 | local css = require(game.Workspace.CSS) |
3 | css.readStylesheet( "stylesheet1" , "constructor1{background:none;}constructor2{background:none;}" ) |
Output:
1 | 20 : 53 : 53.339 - Workspace.CSS: 10 : attempt to concatenate field '?' (a nil value) |
2 | 20 : 53 : 53.359 - Stack Begin |
3 | 20 : 53 : 53.359 - Script 'Workspace.CSS' , Line 10 - upvalue splitStylesheet |
4 | 20 : 53 : 53.360 - Script 'Workspace.CSS' , Line 73 - field readStylesheet |
5 | 20 : 53 : 53.360 - Script 'Players.Player.PlayerGui.PlayerGui.Main' , Line 3 |
6 | 20 : 53 : 53.361 - Stack End |
Anyone know what the problem is? Thanks to anyone who helps :)