Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

loadstring() not working?

Asked by 9 years ago

I am using loadstring() to calculate stuff in my calculator script. I have loadstring enabled in ServerScriptService but when I publish the place and join it it says loadstring not enabled/available.

0
Code please? DigitalVeer 1473 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago
            local calculation = Display.Text
            local function calculate(calc)
                local calculated = loadstring("return "..calculation)() -- <-------
                return calculated
            end
            if string.sub(calculation, 1, 1) == "=" then
                calculation = string.sub(calculation, 2, string.len(calculation))
            end
            Display.LASTCALC.Text = calculation
            Display.Text = "="..calculate(calculation)
0
You know you can edit your question right? By the way, Loadstring is disabled by default and is slowly heading toward deprecation. You can enable loadstring by going to ServerScriptService, and setting LoadStringEnabled to true. M39a9am3R 3210 — 9y
Ad

Answer this question