Replies: 3 comments
-
You have an anonymous function. You need a closure or a regular function and pass the value as a parameter. https://github.com/vlang/v/blob/master/doc/docs.md#anonymous--higher-order-functions |
Beta Was this translation helpful? Give feedback.
-
Thanks for the fast answer. gery@gery-XPS-13-9360:~/projects/vlang/game$ v ./GameServer.v /tmp/v/GameServer.18085048805967199074.tmp.c:6290: error: pointer expected (Use builder error: C error. This should never happen. If you were not working with C interop, this is a compiler bug, please report the bug using https://github.com/vlang/v/issues/new/choose You can also use #help on Discord: https://discord.gg/vlang My full source code (96 lines) is here:
|
Beta Was this translation helpful? Give feedback.
-
I tried a simpler example:
The result is: v ./test.v /tmp/v/test.2488586026076545758.tmp.c:1862: at anon_fn_db322b848a87d5fe_string_142: RUNTIME ERROR: invalid memory access OS: ubuntu linux, V version: 0.2.2 c9d6242 |
Beta Was this translation helpful? Give feedback.
-
I'm developing a websocket game in vlang, I face this problem:
The data variable is not visible inside. There are no global variables in Vlang. Is there any solution or workaround for this problem?
compile error message:
./GameServer.v:97:32: error: undefined ident:
data
95 | if msg.payload == 'get-map'.bytes() {
96 | //create_game().get_map_string()
97 | c.client.write(data.bytes(), websocket.OPCode.text_frame) or { panic(err) }
| ~~~~
98 | }
99 | }
Anyway, I found Vlang very COOL ;)
Beta Was this translation helpful? Give feedback.
All reactions