Jump to content
DavidRM

Compilation Question: Format command

Recommended Posts

Why is this:

const
  RS_S_S_S_LOGGED_IN = '%s (%s, %s) logged in.';

...
Writeln(Format(RS_S_S_S_LOGGED_IN,
  [aUser.Handle, aUser.Email, aPlayer.Socket.RemoteAddress]));
...

Compiling to this:

WriteLn((aUser$1.FHandle$6.toString()+" ("+aUser$1.FEmail.toString()+", "+aPlayer$3.FSocket$1.RemoteAddress.toString()+") logged in."));

 

My thought was that by using Format() with constant strings, I would be reducing the string handling overhead.

Was my thought incorrect?

I also kinda wanted the possibility of (someday) localizing the text.

This is not a bug. Just me trying to better understand what's happening in the conversion to Javascript.

Thanks!

-David

Share this post


Link to post
Share on other sites

That's what I was missing: resourcestring

Now it compiles the way I expected:

WriteLn(Format($R[37],[aUser$1.FHandle$6, aUser$1.FEmail, aPlayer$3.FSocket$1.RemoteAddress]));

Thanks!

-David

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×