Skip to content

coroutines cause the generated modules to break #3

@Python1320

Description

@Python1320

The modules either crash or return incorrect values.

http://facepunch.com/showthread.php?t=1260809&p=42916561#post42916561

Example:

require'example' -- [url]https://github.com/garrynewman/gmod-module-base/blob/master/example/src/gm_example.cpp[/url]
local var
local thread = coroutine.create(function() 
   var = TestFunction(123,321)
   ErrorNoHalt(TestFunction())
   coroutine.yield()
   var = TestFunction()
end)
print("thread",thread) --thread thread: 0xd713a598
print("before",var) --before nil
--  321
print("resume",coroutine.resume(thread),coroutine.status(thread)) --  resume true suspended
print("now",var) -- now 321
print("should be",TestFunction(321)) -- should be Thanks for the number - I love 321.000000!!
print("resume",coroutine.resume(thread),coroutine.status(thread)) -- resume true dead
print("now",var) --  now -2.9528447354403e+111
print("should be",TestFunction()) -- should be This string is returned```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions