diff --git a/tpl/bind_ecslite.twig b/tpl/bind_ecslite.twig index 6851d9a..0de05e9 100644 --- a/tpl/bind_ecslite.twig +++ b/tpl/bind_ecslite.twig @@ -123,13 +123,15 @@ else {%- endif ~%} { - dv = Val.New(frm.vm); var pool = world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>(); if(pool.Has(id)) { + dv = Val.New(frm.vm); var v = pool.Get(id).{{f.name}}; {{ bhl_bind.native2val(f.type, 'v', 'dv') }}; } + else + throw new Exception("No such component '{{token_or(o, 'bhl_native_class', o.name)}}' on entity: " + id); } stack.Push(dv); #endif @@ -162,10 +164,11 @@ var pool = world.GetPool<{{token_or(o, 'bhl_native_class', o.name)}}>(); - {%~ if m.returntype %} if(pool.Has(id)) { + {%~ if m.returntype %} var return_val = + {%- endif ~%} pool.Get(id).{{m.name}}( {%- for arg in m.args ~%} __{{arg.name}}{% if not loop.last %},{% endif %} {%- endfor ~%} @@ -174,18 +177,7 @@ {{ bhl_bind.return_val(m, 'return_val') }} } else - { - //unspecified value - var dv = bhl.Val.New(frm.vm); - stack.Push(dv); - } - {%- else ~%} - - pool.Ensure(id).{{m.name}}( - {%- for arg in m.args ~%} __{{arg.name}}{% if not loop.last %},{% endif %} {%- endfor ~%} - ); - - {%- endif ~%} + throw new Exception("No such component '{{token_or(o, 'bhl_native_class', o.name)}}' on entity: " + id); return null; }