• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Doubt and errors with string formats.

darkshin

New old member
Joined
Dec 14, 2010
Messages
231
Reaction score
22
Hello Guys!

I'm having some bad time trying to make a C++ function read a string sent by a lua function.

The string format used in C++ function is: (const std::string & text)
And this is how I'm setting up the string that will be sent:

local text = string.format(characterInfo.name:getText())

So then, I get debugged and the log file says: "Error reading registry value", also the Locals that is supporting the error is called _Ptr and has this 2 erros: <Unable to read characters of string> ---- <Unable to read memory>.

Could someone enlighten on how this is supposed to be ?

Thankksssssss! :D
 
Maybe because you are using the function incorrectly?
Code:
Create a formatted string from the format and arguments provided. This is similar to the printf("format",...) function in C. An additional option %q puts quotes around a string argument's value.

c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument.
q and s expect a string.
> = string.format("%s %q", "Hello", "Lua user!")   -- string and quoted string
Hello "Lua user!"
> = string.format("%c%c%c", 76,117,97)             -- char
Lua
> = string.format("%e, %E", math.pi,math.pi)       -- exponent
3.141593e+000, 3.141593E+000
> = string.format("%f, %g", math.pi,math.pi)       -- float and compact float
3.141593, 3.14159
> = string.format("%d, %i, %u", -100,-100,-100)    -- signed, signed, unsigned integer
-100, -100, 4294967196
> = string.format("%o, %x, %X", -100,-100,-100)    -- octal, hex, hex
37777777634, ffffff9c, FFFFFF9C
 
Maybe because you are using the function incorrectly?
Code:
Create a formatted string from the format and arguments provided. This is similar to the printf("format",...) function in C. An additional option %q puts quotes around a string argument's value.

c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as argument.
q and s expect a string.
> = string.format("%s %q", "Hello", "Lua user!")   -- string and quoted string
Hello "Lua user!"
> = string.format("%c%c%c", 76,117,97)             -- char
Lua
> = string.format("%e, %E", math.pi,math.pi)       -- exponent
3.141593e+000, 3.141593E+000
> = string.format("%f, %g", math.pi,math.pi)       -- float and compact float
3.141593, 3.14159
> = string.format("%d, %i, %u", -100,-100,-100)    -- signed, signed, unsigned integer
-100, -100, 4294967196
> = string.format("%o, %x, %X", -100,-100,-100)    -- octal, hex, hex
37777777634, ffffff9c, FFFFFF9C

Oh thank you. But none of this worked again :/ I guess I should leave it and find another way to do what I want.
 
Back
Top