Ошибка expected near

When I attempt to run my script, I get an error returning on a variable assignment. I’ve re-checked my syntax many times and it doesn’t seem to be a mistake I made there—I even had somebody else look at it just in case. However, the error that returns continuously points me to the syntax, and I can’t seem to find a solution to this problem.

Here is the whole troublesome function:

    function registerquestlines()
       if player["testline"] == nil then
            player["testline"] = {"prog" = {true,false,false}, "quests" = {"testline1", "testline2", "testline3"}, "prog#" = 1}
       end
    end

Again, the error I get is: ‘}’ expected near ‘=’ on the line in which I assign values to player[«testline»].

Hi, Justin,

Same problem here, and it persists.

I installed torch-hd5 locally on ubuntu 14.04, following ‘https://github.com/deepmind/torch-hdf5/blob/master/doc/usage.md’
Message:
hdf5 0-0 is now built and installed in /people/huang/tools/torch/install/ (license: BSD)

I tried to run on a cluster with gpu, and train.lua fails because of hdf5.

Environment settings
set torch_rnn=/people/huang/tools/torch-rnn
setenv PATH /people/huang/tools/torch/install/bin:${PATH}
setenv LD_LIBRARY_PATH /people/huang/tools/torch/install/lib:${LD_LIBRARY_PATH}
setenv PATH /usr/local/cuda/bin:${PATH}
setenv LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH}
setenv PYTHONPATH /people/huang/local/canopy/User/lib/python2.7/site-packages/

Error message when running train.lua
th $torch_rnn/train.lua -input_h5 $tmp/lm_lstm_torch/data/my_data.h5 -input_json $tmp/lm_lstm_torch/data/my_data.json -model_type lstm -num_layers 3 -rnn_size 512 -gpu_backend opencl > $tmp/lm_lstm_torch/lm_lstm_torch.log /people/huang/tools/torch/install/bin/luajit: ...e/huang/tools/torch/install/share/lua/5.1/trepl/init.lua:363: ...e/huang/tools/torch/install/share/lua/5.1/trepl/init.lua:363: ...ple/huang/tools/torch/install/share/lua/5.1/hdf5/ffi.lua:29: libhdf5.so: cannot open shared object file: No such file or directory stack traceback: [C]: in function 'error' ...e/huang/tools/torch/install/share/lua/5.1/trepl/init.lua:363: in function 'require' /people/huang/tools/torch-rnn/train.lua:6: in main chunk [C]: in function 'dofile' ...ools/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk [C]: at 0x00406670

$tmp/lm_lstm_torch/lm_lstm_torch.log
/people/huang/tools/torch/install/share/lua/5.1/hdf5/init.lua:15 Unable to find the HDF5 lib we were built against - trying to find it elsewhere

0 / 0 / 0

Регистрация: 10.08.2021

Сообщений: 1

1

10.08.2021, 22:23. Показов 4594. Ответов 1


Студворк — интернет-сервис помощи студентам

Всем привет, что с этим делать?

Error(s), warning(s):
lua5.3: …sktop/rextester_linux_2.0/usercode/2089609975/source.lua:4: ‘)’ expected near ‘=’



0



965 / 1664 / 171

Регистрация: 07.05.2013

Сообщений: 3,589

Записей в блоге: 12

11.08.2021, 06:57

2

Продолжать скрывать подробности.

ps: Проверьте скобки, похоже, что вместо фигурной была впендюрина обычная.

) это не то же самое, что }



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

11.08.2021, 06:57

Помогаю со студенческими работами здесь

Ошибка: ‘[‘ expected but ‘:=’ found
unit lab;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,…

Ошибка expected expression
Не понимаю где здесь ошибка:

Range("F1").DataSeriesRowcol:=xlColumns, Type:=xlLinear, Step:=a,…

Ошибка error expected ( before k
Выдает ошибку: Ошибка error expected ( before k

#include <iostream>

using namespace std;

Ошибка ‘(‘ expected but THEN found
Процедура ввода, на этапе проверки принадлежности числа к множеству (if) выдается данная в…

Ошибка: Expected ‘=’ but ‘(‘ found
При компилировании программы выскакивает ошибка "Expected ‘=’ but ‘(‘ found" , и это после того,…

Ошибка! expected a declaration
Кто знает, при написании кода постоянно вылетает ошибка expected a declaration, после часа…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

2

Albertio

Attention! Thanks for your attention.


  • #3

function main()
    repeat wait(0) until isSampAvailable()
        sampRegisterChatCommand('chr', chr)
        while true do
            wait(0)
end
function chr(id)
local result = sampIsPlayerConnected(id)
if result then
    local nick = sampGetPlayerNickname(id)
    local hp = sampGetPlayerHealth(id)
    local ping = sampGetPlayerPing(id)
    local score = sampGetPlayerScore(id)
    whait(2000)
    sampAddChatMessage('{CC0000}[На сервере!]{FFFFFF}[Никнейм]':..nick.. '{FFFFFF}[ХП]:' ..hp.. '{FFFFFF}[Пинг]:' ..ping.. '{FFFFFF}[Уровень]:' ..score..), -1)
 end
end

Albertio

Attention! Thanks for your attention.


  • #4

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand('chr', chr)
  while true do
    wait(0)
  end
end

function chr(id)
  local result = sampIsPlayerConnected(id)
  if result then
    local nick = sampGetPlayerNickname(id)
    local hp = sampGetPlayerHealth(id)
    local ping = sampGetPlayerPing(id)
    local score = sampGetPlayerScore(id)
    whait(2000)
    sampAddChatMessage(('{CC0000}[На сервере!]{FFFFFF}[Никнейм]:'..nick..'{FFFFFF}[ХП]:'..hp..'{FFFFFF}[Пинг]:'..ping..'{FFFFFF}[Уровень]:'..score), -1)
  end
end

  • #5

[ML] (error) Checker: C:UsersUserDesktopseansizemoonloaderchecker.lua:20: attempt to call global ‘whait’ (a nil value)
stack traceback:
C:Users˸õàDesktopseansizemoonloaderchecker.lua:20: in function

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand('chr', chr)
  while true do
    wait(0)
  end
end

function chr(id)
  local result = sampIsPlayerConnected(id)
  if result then
    local nick = sampGetPlayerNickname(id)
    local hp = sampGetPlayerHealth(id)
    local ping = sampGetPlayerPing(id)
    local score = sampGetPlayerScore(id)
    whait(2000)
    sampAddChatMessage(('{CC0000}[На сервере!]{FFFFFF}[Никнейм]:'..nick..'{FFFFFF}[ХП]:'..hp..'{FFFFFF}[Пинг]:'..ping..'{FFFFFF}[Уровень]:'..score), -1)
  end
end

Albertio

Attention! Thanks for your attention.


  • #6

[ML] (error) Checker: C:UsersUserDesktopseansizemoonloaderchecker.lua:20: attempt to call global ‘whait’ (a nil value)
stack traceback:
C:Users˸õàDesktopseansizemoonloaderchecker.lua:20: in function <C:UsersUserDesktopseansizemoonloaderchecker.lua:13>
[ML] (error) Checker: Script died due to an error. (019C479C)

Сорян не заметил, строчку
whait(2000)
замени на
wait(2000)

imring


  • #7

Сорян не заметил, строчку
whait(2000)
замени на
wait(2000)

а зачем там задержка? да и еще без отдельного потока…

Albertio

Attention! Thanks for your attention.


  • #8

а зачем там задержка? да и еще без отдельного потока…

Честное слово ху* знает, но если человеку надо пусть юзает lua_thread.create

  • #9

Сорян но у меня у самого уже горит от меня такого проблемного но вот такая ошибка
Checker: C:Users˸õàDesktopseansizemoonloaderchecker.lua:20: attempt to yield across C-call boundary
stack traceback:
[C]: in function ‘wait’

Сорян не заметил, строчку
whait(2000)
замени на
wait(2000)

Сорян но у меня у самого уже горит от меня такого проблемного но вот такая ошибка
Checker: C:Users˸õàDesktopseansizemoonloaderchecker.lua:20: attempt to yield across C-call boundary
stack traceback:
[C]: in function ‘wait’

ребят я не шарю сильно в этом 1 день работы с lua

Albertio

Attention! Thanks for your attention.


  • #10

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand('chr', chr)
  while true do
    wait(0)
  end
end

function chr(id)
  lua_thread.create(function()
    local result = sampIsPlayerConnected(id)
    if result then
      local nick = sampGetPlayerNickname(id)
      local hp = sampGetPlayerHealth(id)
      local ping = sampGetPlayerPing(id)
      local score = sampGetPlayerScore(id)
      wait(2000)
      sampAddChatMessage(('{CC0000}[На сервере!]{FFFFFF}[Никнейм]:'..nick..'{FFFFFF}[ХП]:'..hp..'{FFFFFF}[Пинг]:'..ping..'{FFFFFF}[Уровень]:'..score), -1)
    end
  end)
end

  • #11

Чувак спасибо, ты лучший просто спас меня

SamperJostkiy


  • #12

я изменил его немного что бы было удобней для себя(знаю что не много) и вот такой у меня получился код.И тут у меня появился вопрос как узнать ифну о себе? тоесть если ввести ид другого игрока то он будет работать, а если ввести свой ид то он не будет работать

и ещё вопросик, если просто ввести /stat то игра возьмёт 0-ой ид, как это исправить? что бы она писала: [Информация о игроке]: Использование /stat id

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand('helpStat', helpStat)
  sampRegisterChatCommand('stat', stat)
  while true do
    wait(0)
  end
end

function stat(id)
  lua_thread.create(function()
    local result = sampIsPlayerConnected(id)
    if result then
      local nick = sampGetPlayerNickname(id)
      local hp = sampGetPlayerHealth(id)
      local ping = sampGetPlayerPing(id)
      local score = sampGetPlayerScore(id)
      wait(0)
      sampAddChatMessage(('{CC0000}[На сервере!]{FFFFFF}[Никнейм]:'..nick..'{FFFFFF}[ХП]:'..hp..'{FFFFFF}[Пинг]:'..ping..'{FFFFFF}[Уровень]:'..score), -1)
    else
      sampAddChatMessage("вы ввели свой ид, либо игрока нет на сервере", 0xFF004D)
    end
  end)
end

function helpStat()
    sampAddChatMessage("[Информация о игроке], для работы используйте: /stat id", -1)
end

  • #13

Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.

я изменил его немного что бы было удобней для себя(знаю что не много) и вот такой у меня получился код.И тут у меня появился вопрос как узнать ифну о себе? тоесть если ввести ид другого игрока то он будет работать, а если ввести свой ид то он не будет работать

и ещё вопросик, если просто ввести /stat то игра возьмёт 0-ой ид, как это исправить? что бы она писала: [Информация о игроке]: Использование /stat id

function main()
  if not isSampLoaded() or not isSampfuncsLoaded() then return end
  while not isSampAvailable() do wait(100) end
  sampRegisterChatCommand('helpStat', helpStat)
  sampRegisterChatCommand('stat', stat)
  while true do
    wait(0)
  end
end

function stat(id)
  lua_thread.create(function()
    local result = sampIsPlayerConnected(id)
    if result then
      local nick = sampGetPlayerNickname(id)
      local hp = sampGetPlayerHealth(id)
      local ping = sampGetPlayerPing(id)
      local score = sampGetPlayerScore(id)
      wait(0)
      sampAddChatMessage(('{CC0000}[На сервере!]{FFFFFF}[Никнейм]:'..nick..'{FFFFFF}[ХП]:'..hp..'{FFFFFF}[Пинг]:'..ping..'{FFFFFF}[Уровень]:'..score), -1)
    else
      sampAddChatMessage("вы ввели свой ид, либо игрока нет на сервере", 0xFF004D)
    end
  end)
end

function helpStat()
    sampAddChatMessage("[Информация о игроке], для работы используйте: /stat id", -1)
end

актуалочка

Skip to content

I have had some problems while coding my NodeMCU in LUA in that I ran into problems during the upload giving me error messages like

stdin:1: ')' expected near ']'

or

stdin:1: ')' expected near '='

This is before execution so it seems that even during the upload there is some checking. What I’ve found so far is that the following does not work:

a = b[d]

During upload you can then get this error, however… if you put a space after the close square bracket (before the next line), you do not get the error. I also found that the following gives an error:

a = b[c[d]]

where it does not matter what the variable names are and d can even be a string. Just the fact that there are two square brackets after each other gives the error. In this case, it is not enough to put a space at the end of the line. You also need to put a space between the two close square brackets.

Понравилась статья? Поделить с друзьями:

Не пропустите эти материалы по теме:

  • Яндекс еда ошибка привязки карты
  • Ошибка expected at end of input
  • Ошибка exiting pxe rom при загрузке
  • Ошибка exit fatal error cannot initialize
  • Ошибка execute command error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии