1

There is a function on Lua:

STRING getClassesList()

It returns string as it is to get on c++:

This does not work:

Const char * ClassesStr;
Lua_getglobal (L, "getClassesList");
Lua_pcall (L, 1, 1, 0);
ClassesStr = lua_tostring (L, 1);

stack: 'readQuikAgent' 'attempt to call a table value'

The function is designed to obtain a list of class codes sent from the server during the communication session. The class codes in the list are separated by a comma ",". At the end of the received line, the symbol "," is always appended.

Call format:

STRING getClassesList ()

Example:

List = getClassesList ()

As a result of the above line of code, the list variable contains a string of the form:

OPTEXP, USDRUB, PSOPT, PSFUT, SPBFUT

8
  • 1
    What is readQuikAgent? Commented May 25, 2017 at 5:48
  • This is my program. Commented May 25, 2017 at 5:50
  • Then you didn't show enough code. See How to create a Minimal, Complete, and Verifiable example Commented May 25, 2017 at 6:02
  • 1
    STRING getClassesList() is not a valid Lua function signature. Commented May 25, 2017 at 6:09
  • 1
    Your specific lua_pcall(L, 1, 1, 0) call expects the function and one argument on the Lua stack. You only push the function. Commented May 25, 2017 at 6:40

2 Answers 2

2

'attempt to call table value' means that the item at the top of the lua stack is a table not a function.

So the result of the getglobal was a table, and that can not be called.

Sign up to request clarification or add additional context in comments.

Comments

1

It works (thank you siffiejoe):

lua_pcall(L, 0, 1, 0);
ClassesStr = lua_tostring(L, -1);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.