Micha Posted December 15, 2014 Share Posted December 15, 2014 (edited) "Hello World"-Modder here. So im playing around with the DST API, trying to make myself a home. I dont understand why the following code throws an exception(attem to call a global): modmain.lua:TheInput:AddKeyDownHandler(GLOBAL.KEY_P, function() DebugSpawn("ash") end)Using DebugSpawn or c_spawn from within the console just works, so I guess I'm not in the right namespace. How will I make generic console commands available to a selfwritten mod? Sorry if this is noobish, I swear I searched the forums but didnt find/understand something of relevance. Edit: Thanks for the help guys Edited January 6, 2015 by Micha Link to comment https://forums.kleientertainment.com/forums/topic/46438-question-about-namespaces-and-console-commands/ Share on other sites More sharing options...
rezecib Posted December 15, 2014 Share Posted December 15, 2014 GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_P, function() GLOBAL.SpawnPrefab("ash") end) Link to comment https://forums.kleientertainment.com/forums/topic/46438-question-about-namespaces-and-console-commands/#findComment-586252 Share on other sites More sharing options...
Developer PeterA Posted December 15, 2014 Developer Share Posted December 15, 2014 @rezecib, is correct you need to prepend your calls to the global namespace with "GLOBAL." This is due to your modmain file being run in a protected sandbox. Link to comment https://forums.kleientertainment.com/forums/topic/46438-question-about-namespaces-and-console-commands/#findComment-586547 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now