equal
deleted
inserted
replaced
321 |
321 |
322 = Params = |
322 = Params = |
323 The Params library is a small library introduced in 0.9.21. It provides a function to parse the parameter string `ScriptParam` and it is intended to simplify using this string. |
323 The Params library is a small library introduced in 0.9.21. It provides a function to parse the parameter string `ScriptParam` and it is intended to simplify using this string. |
324 |
324 |
325 This library requires the parameter string to be in a certain format. It must be a comma-seperated list of kev-value pairs in the `key=value` format. Examples: |
325 This library requires the parameter string to be in a certain format. It must be a comma-seperated list of kev-value pairs in the `key=value` format. Examples: |
326 {{{ |
326 |
327 speed=1 |
327 <code>speed=1</code> |
328 health=100, ammo=5 |
328 <code>health=100, ammo=5</code> |
329 param1=hello, param2=whatever, param3=5325.4 |
329 <code>param1=hello, param2=whatever, param3=5325.4</code> |
330 }}} |
330 |
331 |
331 Using this library is by no means neccessary, you could use practically whatever syntax you wish if you write your own code for parsing. |
332 Using this library is by no means neccessary. |
|
333 |
332 |
334 === `parseParams()` === |
333 === `parseParams()` === |
335 Parses `ScriptParam` and writes the result into the global table `params`. The table will follow the `key=value` pattern. Both keys and pairs are stored as string. |
334 Parses `ScriptParam` and writes the result into the global table `params`. The table will follow the `key=value` pattern. Both keys and pairs are stored as string. |
336 |
335 |
337 ==== Example ==== |
336 ==== Example ==== |
343 end |
342 end |
344 end</code> |
343 end</code> |
345 |
344 |
346 If the key-value pair `myparam1=hello` is present, this script writes “Hello World!” in the console. All these inputs would trigger the event: |
345 If the key-value pair `myparam1=hello` is present, this script writes “Hello World!” in the console. All these inputs would trigger the event: |
347 |
346 |
348 {{{ |
347 <code>myparam1=hello</code> |
349 myparam1=hello |
348 <code>myparam2=whatever, myparam1=hello</code> |
350 myparam2=whatever, myparam1=hello |
349 <code>g=4, f=56, m=56, myparam1=hello</code> |
351 g=4, f=56, m=56, myparam1=hello |
|
352 }}} |
|