I do not understand it.

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

I do not understand it.

by BrunoMine » Wed Dec 04, 2013 20:16

I already checked everything. The error displayed is this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
ERROR[main]: ========== ERROR FROM LUA ===========
ERROR[main]: Failed to load and run script from
ERROR[main]: C:\Users\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua:
ERROR[main]: ...ers\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua:5: ']' expected near ','
ERROR[main]: =======END OF ERROR FROM LUA ========
ERROR[main]: Server: Failed to load and run C:\Users\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua
ERROR[main]: ModError: Failed to load and run C:\Users\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua



Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local function updateCondenser(meta)
    local inv = meta:get_inventory()
    invsize [8,9;]
    list [contexto; principal; 0,0; 8,4;]
    list [current_player; principal; 0,5; 8,4;]
    return formspec
end

minetest.register_node("pc:computador", {
    description = "Computador",
    tiles = {"computador.png"},
    paramtype = "light",   
    paramtype2 = "facedir",
    inventory_image = "computador.png",
    is_ground_content = true,
    groups = {tree=3,choppy=3,oddly_breakable_by_hand=5,flammable=3},
      sounds = default.node_sound_glass_defaults(),
      on_construct = function(pos)
        local meta = minetest.get_meta(pos)
        local inv = meta:get_inventory()
        meta:set_string("formspec", updateCondenser(meta))
    end,
})


What is missing to finish?
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Dec 04, 2013 20:46

The formspec is meant to be a string.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local formspec = "invsive[8,9;]"..
    "list [contexto; principal; 0,0; 8,4;]"..
    "list [current_player; principal; 0,5; 8,4;]"
return formspec
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

by BrunoMine » Wed Dec 04, 2013 21:54

PilzAdam wrote:The formspec is meant to be a string.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local formspec = "invsive[8,9;]"..
    "list [contexto; principal; 0,0; 8,4;]"..
    "list [current_player; principal; 0,5; 8,4;]"
return formspec

Thank you!
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

by BrunoMine » Thu Dec 05, 2013 02:09

The value is not null. Or am I not seeing this.

[spoiler=debug]
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
00:05:11: ACTION[main]:         .__               __                   __   
00:05:11: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_
00:05:11: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
00:05:11: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  | 
00:05:11: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__| 
00:05:11: ACTION[main]:       \/        \/     \/          \/     \/       
00:05:11: ACTION[main]: World at [C:\Users\Bruno\Desktop\minetest-0.4.7\bin\..\worlds\teste computdor]
00:05:11: ACTION[main]: Server for gameid="minetest" listening on port 30011.
creative inventory size: 177
00:05:11: ACTION[ServerThread]: singleplayer joins game. List of players: singleplayer
Font size: 8 17
00:05:17: ACTION[ServerThread]: singleplayer places node pc:computador at (6,11,-12)
00:05:17: ACTION[ServerThread]: facedir: 3
00:05:18: ACTION[ServerThread]: singleplayer leaves game. List of players:
00:05:18: ERROR[main]: ServerError: LuaError: error: ...ers\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua:24: attempt to index global 'meta' (a nil value)
00:05:18: ERROR[main]: stack traceback:
[/spoiler]

[spoiler=init.lua]
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- mods/pc/init.lua


local function acesso(meta)
    local meta = minetest.get_meta(pos)
    meta:set_string("formspec",
           "size[8,9]"..
        "list[current_name;main;0,0;8,4;]"..
        "list[current_player;main;0,5;8,4;]")
    return formspec
end

minetest.register_node("pc:computador", {
    description = "Computador",
    tiles = {"computador.png"},
    paramtype = "light",   
    paramtype2 = "facedir",
    inventory_image = "computador.png",
    is_ground_content = true,
    groups = {tree=3,choppy=3,oddly_breakable_by_hand=5,flammable=3},
      sounds = default.node_sound_glass_defaults(),
    on_rightclick = function(pos)
        meta:set_string(acesso(meta))
    end,
})
[/spoiler]
Last edited by BrunoMine on Thu Dec 05, 2013 02:09, edited 1 time in total.
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Dec 05, 2013 13:34

brunob.santos wrote:The value is not null. Or am I not seeing this.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
00:05:11: ACTION[main]:         .__               __                   __   
00:05:11: ACTION[main]:   _____ |__| ____   _____/  |_  ____   _______/  |_
00:05:11: ACTION[main]:  /     \|  |/    \_/ __ \   __\/ __ \ /  ___/\   __\
00:05:11: ACTION[main]: |  Y Y  \  |   |  \  ___/|  | \  ___/ \___ \  |  | 
00:05:11: ACTION[main]: |__|_|  /__|___|  /\___  >__|  \___  >____  > |__| 
00:05:11: ACTION[main]:       \/        \/     \/          \/     \/       
00:05:11: ACTION[main]: World at [C:\Users\Bruno\Desktop\minetest-0.4.7\bin\..\worlds\teste computdor]
00:05:11: ACTION[main]: Server for gameid="minetest" listening on port 30011.
creative inventory size: 177
00:05:11: ACTION[ServerThread]: singleplayer joins game. List of players: singleplayer
Font size: 8 17
00:05:17: ACTION[ServerThread]: singleplayer places node pc:computador at (6,11,-12)
00:05:17: ACTION[ServerThread]: facedir: 3
00:05:18: ACTION[ServerThread]: singleplayer leaves game. List of players:
00:05:18: ERROR[main]: ServerError: LuaError: error: ...ers\Bruno\Desktop\minetest-0.4.7\bin\..\mods\pc\init.lua:24: attempt to index global 'meta' (a nil value)
00:05:18: ERROR[main]: stack traceback:


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- mods/pc/init.lua


local function acesso(meta)
    local meta = minetest.get_meta(pos)
    meta:set_string("formspec",
           "size[8,9]"..
        "list[current_name;main;0,0;8,4;]"..
        "list[current_player;main;0,5;8,4;]")
    return formspec
end

minetest.register_node("pc:computador", {
    description = "Computador",
    tiles = {"computador.png"},
    paramtype = "light",   
    paramtype2 = "facedir",
    inventory_image = "computador.png",
    is_ground_content = true,
    groups = {tree=3,choppy=3,oddly_breakable_by_hand=5,flammable=3},
      sounds = default.node_sound_glass_defaults(),
    on_rightclick = function(pos)
        meta:set_string(acesso(meta))
    end,
})

Of course it is nil, you only define "meta" as a local variable in the function "acesso"
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

by BrunoMine » Thu Dec 05, 2013 16:11

understood. I guess I forgot to check that part. Thank you again.
My small square universe under construction ... Minemacro
Comunidade Minetest Brasil
www.minetestbrasil.com
 


Return to Minetest-Related

Who is online

Users browsing this forum: No registered users and 34 guests

cron