MF99K Posted April 10, 2016 Share Posted April 10, 2016 I'm trying to make a mod that lets the player plant mushroom caps. I thought that setting up the ondeploy function with a SpawnPrefab(..."name") to spawn the mushroom based on the cap color would work, but it makes the game crash. How should I set up this part of the function? Link to comment https://forums.kleientertainment.com/forums/topic/66229-vararg-ellipsis-error-name/ Share on other sites More sharing options...
DarkXero Posted April 10, 2016 Share Posted April 10, 2016 I don't get where the ellipsis come from. SpawnPrefab(..."name") makes no sense whatsoever. Or did you have something like? local function(...) local mushroom = SpawnPrefab(..."name") end Well that's not how the ellipsis work. Info here: http://www.lua.org/pil/5.2.html You can do it like: local deployed = { red_cap = "red_mushroom", green_cap = "green_mushroom", blue_cap = "blue_mushroom", } local mushroom = SpawnPrefab(deployed[inst.prefab]) Link to comment https://forums.kleientertainment.com/forums/topic/66229-vararg-ellipsis-error-name/#findComment-747876 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