This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

Problem wihen using void methods inside methods :D

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Locked
jamisco
Superfighter
Superfighter
Posts: 67
Joined: Sun Nov 06, 2016 11:34 pm
Title: Da God
SFD Account: Jamisco
SFD Alias: Jamisco
Started SFD: either late 2015 or early 2016
Location: Somewhere in the east of the United states
Gender:
Age: 105

Problem wihen using void methods inside methods :D

Post by jamisco » Fri Jul 14, 2017 5:29 pm

Why do i get an error when i compile code when i do some thing like this? Normally this should work, atleast it works in visual studio.

Code: Select all


        public void OnStartup()
        {
	     void Life()
            {
                 Game.ShowPopupMessage("life");
            }
	   Life();
        }
I get this error code
picture of error message

Whats causing the problem and how do i fix it

Thanks!! :D
0 x
Is it better to be feared or respected... please, is it too much to ask for both?

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1887
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 36

Post by Gurt » Fri Jul 14, 2017 6:49 pm

Local functions are only supported in C#7. You're limited to features in C#4 (or maybe C#5 - I don't remember exactly) in SFD.
1 x
Gurt

Locked