## I have a Problem to put two variables in one

yves_de_beck
Member

Posts: 65
Joined: Wed Jan 02, 2013 10:45
Location: Germany Herford

### I have a Problem to put two variables in one

Hallo all,

Perhaps someone have an idea to fix my problem:

I make some experiments with the nodebox value.

I want make from two variables one:

My Example:
variable1 = {abcabc}
variable2 = {xyzxyz}

varibalenew = variable1 variable2

--> output of 'variablenew' should be -> {abcabc}{xyzxyz}

I have tryed all. It won't work =(

this is my code:

Code: Select all
`math.randomseed(os.time())local detail = 16local testnoc = {}local testbox1 = {}local testbox2 = {}for i = 0, detail-1 do    hoehe = math.random (0,5)    testbox1[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}    hoehe = math.random (0,5)    testbox2[i+1]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}endlocal testbox = testbox1, testbox2    minetest.register_node("test:test_object2", {    description = "TEST OBJECT2",    drawtype = "nodebox",    tiles = {"default_desert_sand.png"},    paramtype = "light",    paramtype2 = "facedir",    walkable = true,    selection_box = {        type = "fixed",        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},    },    node_box = {        type = "fixed",        fixed = testbox,    },    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},})`

Now it works without an error, but in the var 'testbox' is only the value of 'testbox1'.

Wat i'm doing wrong???
Last edited by yves_de_beck on Mon Jan 21, 2013 12:23, edited 1 time in total.

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Try something like this:
Code: Select all
`math.randomseed(os.time())local detail = 16local testnoc = {}local testbox = {}for i = 0, detail-1, 2 do    hoehe = math.random (0,5)    testbox[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}    hoehe = math.random (0,5)    testbox[i+2]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}endminetest.register_node("test:test_object2", {    description = "TEST OBJECT2",    drawtype = "nodebox",    tiles = {"default_desert_sand.png"},    paramtype = "light",    paramtype2 = "facedir",    walkable = true,    selection_box = {        type = "fixed",        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},    },    node_box = {        type = "fixed",        fixed = testbox,    },    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},})`
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

yves_de_beck
Member

Posts: 65
Joined: Wed Jan 02, 2013 10:45
Location: Germany Herford
kaeza wrote:Try something like this:
Code: Select all
`math.randomseed(os.time())local detail = 16local testnoc = {}local testbox = {}for i = 0, detail-1, 2 do    hoehe = math.random (0,5)    testbox[i+1]={-0.5, -0.5, (i/detail)-0.5, -0.5+(1/detail), hoehe*0.1, (i/detail)-0.5+(1/detail)}    hoehe = math.random (0,5)    testbox[i+2]={-0.5+(1/detail), -0.5, (i/detail)-0.5, -0.5+(2*(1/detail)), hoehe*0.1, (i/detail)-0.5+(1/detail)}endminetest.register_node("test:test_object2", {    description = "TEST OBJECT2",    drawtype = "nodebox",    tiles = {"default_desert_sand.png"},    paramtype = "light",    paramtype2 = "facedir",    walkable = true,    selection_box = {        type = "fixed",        fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},    },    node_box = {        type = "fixed",        fixed = testbox,    },    groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},})`

Wooooow thank you for the very fast answer kaeza!!!! =) =)

I've tested it.... and it works.

Super!!
Last edited by yves_de_beck on Mon Jan 21, 2013 12:41, edited 1 time in total.

kaeza
Moderator

Posts: 2162
Joined: Thu Oct 18, 2012 05:00
Location: Montevideo, Uruguay
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
yves_de_beck wrote:Wooooow thank you for the very fast answer kaeza!!!! =) =)

I've tested it.... and it works.

Super!!

You're welcome :)
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal