Skip to content

functions

The documentation may not be up-to-date with the latest version of fc2.hpp found on the repo.

ping

This method will send the current tick to the FC2 solution. The solution will then print the response tick and the tick difference. The start and end time are returned in a pair. See examples/ping_pong/ on the repo.

Returns

  • std::pair< unsigned long long, unsigned long long >

api

This method will send a Web API request. This works like fantasy.api in the Lua module. The Web API always returns in JSON format. Consider this when reading the return result.

Some projects that help parse JSON data:

Parameters

  • const std::string &

Returns

  • std::string

lua

This method will allow you to run Lua code inside FC2. This is similar to /lua in the HTTP module.

Parameters

  • const std::string &

call

This method works like /luar, in which, you can force FC2 to invoke the on_team_call callback for all Lua scripts. The value returned from the callback will be returned depending on how you prefer it casted. The std::string parameter requires an identifier. Remember that when a callback is triggered in FC2, all scripts with the callback will react. Use the identifier to help FC2 know the intentions of your call.

If you do not wish to return a value, do not specify a type, nor fulfill the FC2_LUA_TYPE parameter.

The json argument is optional. By passing a JSON string, you can make FC2 automatically parse the data and convert it to a Lua table. This is useful for sending data through this function.

See examples/call/ on the repo.

Parameters

  • const std::string &
  • FC2_LUA_TYPE
  • const std::string & json

Returns

  • type

get_version

This gets current compiled FC2T version.

Returns

  • std::pair< unsigned int, unsigned int >

get_error

Gets last FC2T error.

Returns

  • FC2_TEAM_ERROR_CODES