Jump to content

Urwigo - changing zone status

Followers 2

Recommended Posts

For testing & bugging purpose, I want to set up a hidden zone that when you enter you are asked to choice a zone to change from Inactive to Active or ice versa.


Is there a way to do this without having to create a lot of If/Else test statements?

Link to comment

AFAIK no :(

In this case I would recommend you to write the If/Else commands as code and not with the blocks (it's easier :))

function getZone(zoneName) 
    if (zoneName == "zone1") then
    	return zone1;
    elseif (zoneName == "zone2") then
    	return zone2;
    -- And so on
-- This only works if you also name the zones with an identifier (under description)

Or has lua a switch statement?

Link to comment
16 hours ago, capoaira said:

switch statement


You can bodge one together by indexing into a table with named keys, I think. I'm not sure if this works on all players. 


local LookupTable = {
    zoneA = ...,
    zoneB = ...,
    zoneC = ...,

function getName(zoneName)
    return LookupTable[zoneName]



In theory this is as efficient as a jumptable (with some overhead for the hashmap lookup.)

Edited by Hügh
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Followers 2
  • Create New...