Skip to main content
GameDev.net gamedev.net
🔒 Locked

Add enum value from script

Started by justin12343 Sep 2, 2011 at 4:11 PM 0 replies 1.1k views
Original Post
justin12343
justin12343
Would it be possible to use a enum value that was registered in the same script?


register_value("test", "test_value", 1);
int i = test_value;
behc
behc
I think it's not possible because test_value doesn't exist at compile time. You would have to break this code in two separate modules. Compile and execute first one with [font=CourierNew, monospace][size=2]register_value [/font][font="Arial"][size=2]calls[size=2], an[/font]d then compile second one with previously registered values.

But if all you want to do is to create an enum, why don't declare it in common way?
like (in script)
enum test
{
test_value = 1
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.