How to create a E2 function in GLua ?

Hello,
I think that a thread is actually posted for this subject but I want to know how I can create some E2 function. I’ve tried this:



e2function returntype functionname(type arg1, type arg2, ...)
     --do stuff
end


I’ve replaced returntype by string and I have an error: " @anonymous_4:7: ‘=’ expected near ‘string’ ".

Could somebody help me please :buckteeth: ?

(Sorry if my english is bad :cat:)

You’ll get better and faster responses on the Wiremod discord which you can find on the Wiremod website. For the sake of answering your question, that syntax is only valid after being ran through the extension loader, as it’s not valid Lua. You’ll want to put that into the custom extensions folder which is located at “wire/lua/entities/gmod_wire_expression2/core/custom”.

Ok thank you :wink:

In Lua you dont need to define the return type, so instead just do



function functionname(arg1, arg2, ...)
     --do stuff
end


Remember, in Lua you don’t need to declare the type of a variable.

This isn’t for Lua functions, Wiremod has an extension loader that gives a custom syntax for creating E2 functions. The loader converts the file to valid Lua.

Is that GLua anymore tho?

Aside from the function definitions everything is normal Lua

I thought he was asking how to convert an E2 function to Lua, not the other way around.