| 125 | } |
| 126 | |
| 127 | static cell_t ReadStringTable(IPluginContext *pContext, const cell_t *params) |
| 128 | { |
| 129 | TABLEID idx = static_cast<TABLEID>(params[1]); |
| 130 | INetworkStringTable *pTable = netstringtables->GetTable(idx); |
| 131 | int stringidx; |
| 132 | const char *value; |
| 133 | size_t numBytes; |
| 134 | |
| 135 | if (!pTable) |
| 136 | { |
| 137 | return pContext->ThrowNativeError("Invalid string table index %d", idx); |
| 138 | } |
| 139 | |
| 140 | stringidx = params[2]; |
| 141 | value = pTable->GetString(stringidx); |
| 142 | |
| 143 | if (!value) |
| 144 | { |
| 145 | return pContext->ThrowNativeError("Invalid string index specified for table (index %d) (table \"%s\")", stringidx, pTable->GetTableName()); |
| 146 | } |
| 147 | |
| 148 | pContext->StringToLocalUTF8(params[3], params[4], value, &numBytes); |
| 149 | |
| 150 | return numBytes; |
| 151 | } |
| 152 | |
| 153 | static cell_t GetStringTableDataLength(IPluginContext *pContext, const cell_t *params) |
| 154 | { |