You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’m programming a game about programming, using a made up language which is written in a text box and ran with a button that splits and checks the code that you write and then runs real functions based on what you wrote, and I need to make it so that each line’s code is counted as seperate code instead of being bunched into one line in the “compiler” so that errors and functions can be ran properly -
What is the issue? Include screenshots / videos if possible!
I’m not able to get it to work, since I don’t know how I can apply the current line being checked to the code “compiler”. Here is the code I have at the moment for looping through the lines. (Full code not shown for security reasons in the future)
-- Other Variables above this in the actual script
local i = 0
local lines = string.split(code, '\n')
for i = i, #lines do
i = i + 1
local args = string.split(lines[i],':')
if not args[2] == nil then
newargs = string.gsub(args[2], '"', "")
-- Continues in the actual script
Please help me figure out how to treat each line as its own little section of code in the “compiler”. Sorry if my post was convoluted or made no sense, its 1 am and it’s pretty hard to describe exactly what I am trying to acheive. (The args are the “functions” and their paramaters, I am trying to get the arg splitter to split only what is on the currently checked line)